Kabul, Afghanistan (CNN) -- Afghan President Hamid Karzai has ordered the release of a group of would-be child suicide attackers ranging between ages 8 and 17.
Some of the 20 youngsters told Karzai that they were recruited by the Taliban, strapped with vests and ordered to detonate them near foreigners, the president's office said in a statement.
Militants told the youngsters that the blasts would spare them but kill the foreigners, the statement said Wednesday.
Karzai asked security forces to free the youth and hand them over to their families.
The president told the children that while other countries are educating youth to be doctors and engineers, militants in Afghanistan are teaching them to be suicide attackers, the statement said.
Afghan and international forces have been battling the Taliban, who are leading an insurgency against the government.
Analysts say the Taliban are recruiting children from Islamic schools and low-income neighborhoods to carry out suicide missions.
In Pakistan, the Taliban promise children rivers of milk and honey, and tell them that virgins await them in heaven, military officials say.
CNN's Matiullah Mati contributed to this report.