The Saffarin Madrasa, or the madrasa of the metalworkers, is the earliest extant madrasa in the Maghrib. It was founded in 1271 by the Marinid Sultan Ya'qub b. 'Abd al-Haqq I, Abu Yusuf (r. 1258-1286) and was the first of the many madrasas founded by the Marinid Sultans within the period of approximately one century.
Like the other Marinid madrasa, the Saffarin is small in scale, with accommodations for students arranged on the ground floor around a lavishly decorated courtyard. The decadent use of glazed tile, intricately carved stucco, and carved and painted wood concentrated in the courtyard would become ubiquitous in Moroccan madrasas. The interpretation, through the decorative program, of materials and techniques from Nasrid palatial architecture into the religious setting of the madrasa is a hallmark of the Marinid foundations, the majority of which are in Fez.
Despite their small scale, the madrasas often served multiple functions in addition to their primary role as teaching institutions. With their fine libraries and their connection to the famous university of al-Qarawiyyin, the Marinid madrasas made the Maghrib, and especially Fez, a celebrated intellectual center.
The contrast between sumptuous ornament in the courtyard and the spartan accommodations for the students at the Saffarin and other Marinid madrasas may reflect the multiple functions of these buildings. The madrasas often served as mosques for their respective quarters and as settings for official ceremonies. With the addition of associated charitable functions like guesthouses and waqfs, or endowed properties which supported the madrasa's upkeep, to their primary role as religious schools, the madrasas functioned as important centers of community life. The courtyard, as the most public of the spaces within the madrasa, was therefore the focus of the ornament that would highlight the generous image of the madrasa's founder.
Hillenbrand, Robert. Islamic Architecture. NY: Columbia UP, 1994. 240-251.