The last Ayyubid sultan of Egypt was al-Salih Najm al-Din Ayyub, who died defending Egypt against the crusader attack that was led by Louis IX. He was the grandson of Salah al-Din Ayyub.
Before his death, he built a unique school (madrasa) with the later addition of a dome. He was buried first in his citadel at the Rawda Island until his wife Shagar al-Durr finished the building of his dome, which is attached now to his madrasa in al-Moezz St.
It was built in the quarter of Bayn al-Qasrayn in Cairo. Its site was a part of the great eastern Fatimid palace. Al-Salih had to demolish some parts of the Fatimid palace to establish 4 iwans for the 4 legal schools of Sunni Islam. It was first in Egypt to establish courses for the 4 schools of law in one place.
During the reign of the Mamluk sultan al-Nasir Muhammad, it was used as a congregational mosque and a pulpit was added to it.
The madrasa consisted of two wings separated by a public passage, each wing comprising a courtyard onto which two opposing iwans open. The larger of the two iwans is oriented towards Mecca.
Each iwan served as a study area designed for one of the four schools.
The dome, the first in Egypt to be attached to a madrasa, was built by Shagar al-Durr.
The minaret is the only preserved minaret from the Ayyubid period. It consists of a square shaft carrying an octagonal second story surmounted by a ribbed helmet supported by an open octagonal structure. A ribbed helmet resting on an open circular or octagonal structure is known as mabkhara “incense burner”.