The United Nations on Wednesday condemned all sides in Afghanistan's conflict for using child soldiers, noting that while government forces have curbed the practice, insurgent groups continue to train large numbers of fighters under the age of 18.

The Afghan government has made progress on the issue, said Leila Zerrougui, the U.N. representative for children and armed conflict. But she said the Afghan Local Police — government-allied groups that often operate as independent militias and are widely seen as unprofessional and corrupt — are major perpetrators.

The Taliban, who have been battling the government for over 15 years, mainly recruit children in provinces bordering Pakistan and other areas where the fighting is fiercest, she said.

Noting that the majority of Afghanistan's population is younger than 18, Zerrougui said child soldiers are "deprived of the minimum of their basic rights."

"They are not going to school, they are deprived of access to health. They are targeted by armed groups and they are prevented from having hope for the future."

Zerrougui spoke to reporters a day after the New York-based Human Rights Watch released a report accusing Taliban forces of boosting the number of children in their ranks since the middle of last year, in violation of international laws.

The report said insurgents "have been training and deploying children for various military operations" in Afghanistan, including making and deploying bombs.

It found that children between the ages of 13 and 17 were given military training in madrassas, or religious schools. Boys began indoctrination as young as six years old, and by the time they were 13 "have learned military skills including use of firearms, and the production and deployment of IEDs," a term for roadside bombs, HRW said.

It said the Taliban had recruited child fighters since the 1990s, but had expanded the practice with new madrassas and training centers in the country's north.

The Taliban condemned the HRW report in an emailed statement Wednesday, saying that it banned the recruitment of children as fighters.

The use of child soldiers is illegal in Afghanistan, which ratified the U.N. Convention on the Rights of the Child in 1994, committing the country to end the recruitment and use of child soldiers.

Despite the downward trend marked by the U.N., the government is still struggling to curtail the practice.

Earlier this month, officials confirmed that a 10-year-old boy had who had been declared a hero after fighting the Taliban was shot dead by insurgents while on his way to school.

Child Soldiers International, a London-based charity, accused the government in a report released last June of slow progress in dealing with child soldier recruitment. The report, which was presented to the U.N. Security Council's working group on children and armed conflict, said recruitment was mainly driven by poverty, but also filial duty, patriotism and honor.