It is one of the most important Circassian Mamluk mosques in Cairo. Founded by Sultan al-Mu’ayyad Shaykh al-Mahmoudy between 818–824 AH / 1415–1421 AD on al-Mu’izz Street. It is built over the remains of a prison called "Khzanet Shama’il" named after Prince ‘Alam al-Din Shama’il, the wali (governor) of Cairo in the reign of Sultan al-Kamil al-Ayyubi.
Before becoming sultan, al-Mu’ayyad had been imprisoned here and during his incarceration, pledged that if God made him ruler, he would build a mosque on the site of the prison. True to his word, upon becoming sultan of Egypt, al-Mu’ayyad ordered the destruction of the prison and the construction of his mosque. When Selim I, the Ottoman sultan visited the mosque of al-Mu’ayyad Shaykh, he said: “This is truly the architecture of kings”.
The mosque has four facades, eastern is the main façade at which located the main entrance on its northern side. It consists of a courtyard, centered with ablution fountain and surrounded by four riwaqs, the largest being riwaq al-qibla (the one on the side of the direction of prayer). Two funerary domes have been built on both side corners of riwaq al-qibla, only one survives. Sultan Mu’ayyad and some his sons were buried in one of these domes while the other was a burial for his family women. Of the mosque’s several other features built by al-Mu’ayyad is the hammam (bath) on the west side of the courtyard. He also built the mosque very close to Bab Zuwayla, and used its towers as bases to the minarets of the mosque. The two minarets were built in Mamluk style and adorned with geometric decorations.