The college was founded during the period of the Marinid (14th century) by the Marinid sultan Abu al-Hassan and allied to the neighbouring Ben Youssef Mosque.[115] This education complex in Koranic teachings was part of similar institutions in Fez, Taza, Tale, and Meknes.[75] The Madrasa was re-constructed by the Saadian Sultan Abdallah al-Ghalib (1557–1574) in 1564 as the largest and unrivaled madrasa in Morocco.[75] In 1565 the works ordered by Abdallah al-Ghalib were finished, as attested by the inscription in the prayer room.[116] Its 130 student dormitory cells cluster around a courtyard richly carved in cedar, marble and stucco.