The majority of the Islamic terrorists (gunmen, suicide bombers, helpers of all sorts) come from madrassas (Islamic schools). Such schools are found all over the Islamic world, but the ones that produce the most terrorists are those that teach a conservative form of Islam, usually one that justifies militant Islam, hatred of non-Moslems and a favorable attitude towards Islamic radicalism. There are probably fewer than five million kids attending these conservative madrassas. But these schools turn out thousands of potential terrorists each year.
An extensive study of the madrassas in Pakistan found that only about 1-2 percent of the nations children were attending the religious schools. Most of the Islamic schools were concentrated in the Pushtun (tribal) areas, where they attracted as much as ten percent in some districts. Earlier nationwide estimates ranged from 10-33 percent. The madrasses tend to teach a conservative version of Islam and stress the need to fight infidels (non-Moslems), but they also teach basic literacy and some math. Since most Islamic states have terrible educations systems, parents see madrassas as a viable option.
Even with the 20,000 or so madrassas in a place like Pakistan, you still have over a third of the children not in school. The national literacy rate is 55 percent. It's lower in Afghanistan. The Gulf States only got high literacy rates in the last few generations, courtesy of all that oil money. Saudi Arabia and Iraq have achieved literacy rates close to 80 percent. But Pakistan and Afghanistan haven't got that wealth. Then again, neither does China, which has a literacy rate of 90 percent (as do most of the East Asian nations). It's a culture thing, which is not politically correct to even mention.
Even children going to state schools in Islamic nations, will get a lot of religious instruction. Parents who can afford it, send their kids to "Western" schools that teach subjects that will help the children get ahead in life. For Moslem nations, students are encouraged to study religion, even in college. While many Moslem kids realize that studying technical subjects will do them more good, at least economically, the Islamic nations turn out fewer technically trained graduates, per capita, than in the West.
This attitude towards secular education has left most Islamic nations illiterate, poor and incubators of terrorism. Trying to change that, brings out the wrath of the Islamic clergy, who insist that the best education is a religious one, and no education at all is best for girls.