A 10-year-old Afghan boy who was declared a hero after fighting the Taliban has been shot dead by insurgents while on his way to school.

Wasil Ahmad, who fought the Taliban alongside his uncle on many occasions, was killed on Monday near his home in Tirin Kot, capital of the southern Uruzgan province, said deputy police chief Rahimullah Khan.

Wasil had been a local celebrity of sorts. Photographs widely circulated on social media show him holding an automatic weapon and wearing a uniform and helmet.

Wasil’s uncle was a former Taliban commander who changed allegiance to the government and was appointed local police commander in Khas Uruzgan district, Khan said.

The use of child soldiers is illegal in Afghanistan, but the charity Child Soldiers International said both government forces and insurgents had been recruiting minors for years.

The organisation’s policy and advocacy director Charu Lata Hogg said the Afghan government, despite pledging to stop the recruitment and use of children by the Afghan security forces, was making “slow and tardy progress”.

She said: “There is a lack of political will to address this issue, and while it’s within the framework of overall human rights violations, there is a specific commitment by the government to clean it up but sufficient measures are not being taken.”

In a June 2015 report presented to the UN security council’s working group on children and armed conflict, the London-based charity said children were recruited by the Afghan national police and the Afghan local police. It said the recruitment was mainly driven by poverty, but also filial duty, patriotism and honour.

The Afghan local police, set up with US and British funding to provide security at a district level, has been widely criticised for a range of abuses, including extortion, as in many places it operates much like an independent militia. The government has been urged to disband the force but relies on it to supplement the overstretched army and police.

The report said that in May of last year the charity found that half of national police checkpoints in Tirin Kot “were staffed with visibly younger officers”, who all acknowledged they were under 18 years old.

“They had been performing all responsibilities of a police officer, which included securing checkpoints and engaging in combat for the last few years,” the report said.

The Afghanistan Independent Human Rights Commission laid blame for the boy’s death with his family, the government and the Taliban. Spokesman Rafiullah Baidar said local police had hailed the boy as a hero after he battled a Taliban siege following the death of his father in fighting.

“Possibly he took up arms to take revenge for his father’s death, but it was illegal for the police to declare him a hero and reveal his identity, especially to the insurgents,” Baidar said. “One side made him famous and the other side killed him – both sides ignored the law and acted illegally.”

Afghanistan ratified the UN convention on the rights of the child in 1994, committing the country to end the recruitment and use of child soldiers.

The Child Soldiers International report said that in the troubled Kunar, Logar and Zabul provinces “10% of law enforcement officials are suspected to be underage”. Although statistics are not available, recruitment is believed to be highest where the insurgency is strongest, notably the southern provinces of Kandahar and Helmand, and provinces bordering Pakistan.

Children are also used by the Taliban in active combat, as spies and as suicide bombers, the report said. It cited a number of attacks, including one last year on the French Institute in Kabul during a packed performance that killed at least two people and wounded another 20.

Children recruited into the armed forces or insurgent groups are vulnerable to sexual abuse, Child Soldiers International said.

Despite a decree from President Ashraf Ghani last February criminalising underage recruitment into the armed forces, the government has “failed to implement proactive mechanisms to identify, verify and release children” who had been recruited, the report said.