Kabul, Afganistan - The Afghan government has changed its policy on madrassas, the religious schools that inspired a generation of fundamentalists who became the Taliban.
Rather than trying to freeze them out, it is trying to bring them into the state system, providing they widen their syllabus to teach other subjects.
The Education Minister Hanif Atmar says: "We are critical of policies in the past. Actually it was a result of those policies to exclude these madrassas, keep them on the margin of the society, and then entirely hand them over to the fundamentalists."
Under the reform the schools will be able to continue to teach subjects connected to the Islamic faith for 40% of the time, but the other 60% will be taken up with more standard subjects - history, geography, science and languages - as well as computer studies.
Mr Atmar likes to remind people that the founder of modern European medicine, Ibn Sina, born about a thousand years ago, studied at an Afghan madrassa: "I think our madrassas will go back to the historic glory these madrassas had. Four or five centuries ago they were the best institutes of education in the east."
The new policy is a direct challenge to neighbouring Pakistan, where madrassas have been a key recruiting ground for the Taliban.
The Speaker of the Upper House of the Afghan parliament, Sibghatullah Mujadidi, says: "In Pakistan some of our students are studying religious subjects and they have been also trained for terrorism.
"If we have enough madrassas in Afghanistan, there will be no need for students to go to Pakistan. They will study here and real moderate Islam will be taught to them."
Dr Mujadidi was speaking at the laying of a foundation stone for new buildings in one of Kabul's oldest madrassas, funded by the reform programme. The aim is to build a state-funded madrassa in every province in the country, as a spearhead of the new policy.
But many madrassas are opposed to the reforms. At the core of their teaching students learn the Koran by rote, and they say they have no time to learn anything other than the ways of Islam - widening the curriculum as the government wants, would dilute the learning.
So there would be no one wise enough to issue fatwas, legal religious orders.
The Dean of one of these madrassas Mullah Rahimullah Azizi says that if they are forced to introduce other subjects then some of his students will go to learn in madrassas in Pakistan.
"A religious student may want to qualify in Afghanistan. But if he sees there is no way to do that properly here, then he has no option but to go abroad.
"And he gets hatred in his heart. He thinks although I have an Islamic government, I do not have the opportunity to study. He will turn against the government, and problems will be created," says Mullah Rahimullah Azizi.
But in this battle for the minds of the next generation, the government believes the flow of students will be the other way.
The Minister Mr Atmar says if they get the reforms right, more Afghans will want to be educated in Afghanistan.
"In Pakistan across the border with Afghanistan there are around 15,000 madrassas, and around 1.5m students are enrolled there. If we invest adequately, and according to the policy of the government of Afghanistan, in our madrassa system, to a large extent those Afghans who are now being taught in madrassas across the border will come back to their own country," said Mr Atmar.
The other main problem is the lack of resources to carry out the reforms.
The government is struggling to fund the building of standard state schools and has failed to win new funding for its reform of madrassas.
Donations from western military sources have filled some of the gap, but the Dean of a madrassa that does want to reform, Abdul Salaam Abed, said: "I know that they want to raise the syllabus and teaching up to international standards.
"But we do not have the capability for that. We may be getting a new syllabus, and that is good.
"But to implement it requires teachers and books, etc. We do not have that. In the madrassas, even if the new syllabus comes, there is no equipment for it. This is our main problem."