In a country where about 99% of the population are Muslim, madrasas were revered colleges where young men memorized the Koran and were taught the intricacies of Islamic law.