 An earthquake in 1302 caused damage to al @-@ Azhar and a number of other mosques throughout Mamluk territory . The responsibility for reconstruction was split among the amirs ( princes ) of the Sultanate and the head of the army , Amir Salar , who was tasked with repairing the damage . These repairs were the first done since the reign of Baibars . Seven years later a dedicated school , the Madrasa al @-@ Aqbaghawiyya , was built along the northwest wall of the mosque . Portions of the wall of the mosque were removed to accommodate the new building . Construction of another school , the Madrasa al @-@ Taybarsiyya began in 1332 – 1333 . This building , which was completed in 1339 @-@ 1340 , would also impact the structure of the mosque as it was built over the site of the mida 'a , the fountain for ablution . Both of the madrasas were built as complementary buildings to al @-@ Azhar , with separate entrances and prayer halls . 
