 When Saladin restored Sunni orthodoxy in Egypt , 10 madrasas were established during his reign , and an additional 25 during the entire Ayyubid period of rule . Each of their locations had religious , political , and economic significance , in particular those in al @-@ Fustat . Most of the schools were dedicated to the Shafi 'i denomination , but others belonged to the Maliki and Hanafi madhabs . The madrasas built near the tomb of Imam al @-@ Shafi 'i were located adjacent to the important centers of pilgrimage and were a major focus of Sunni devotion . About 26 schools were built in Egypt , Jerusalem and Damascus by high @-@ ranking government officials , and unusual for the time , commoners also founded in Egypt about 18 schools , including two medical institutions . 
