During the rule of the Fatimid and Mamluk dynasties and their successor states in the medieval Middle East, many of the ruling elite founded madaris through a religious endowment known as the waqf. Not only was the madrasa a potent symbol of status but it was an effective means of transmitting wealth and status to their descendants. Especially during the Mamlūk period, when only former slaves could assume power, the sons of the ruling Mamlūk elite were unable to inherit. Guaranteed positions within the new madaris thus allowed them to maintain status. Madaris built in this period include the Mosque-Madrasah of Sultan Ḥasan in Cairo.
If it is possible to answer this question, answer it for me (else, reply "unanswerable"): Which class of people founded the madaris during the medieval period?
ruling elite