One of the oldest Mamluk mosques, Sultan Baybars al-Bunduqdari (658–676 AH / 1260–1277 AD) commissioned its construction on approximately 12,600 meters square of land in 665 AH / 1266 AD on what is today al-Zahir Square, and prayers were held there for centuries. Four riwaqs (arcades) surround a central courtyard, the largest of these is the qibla riwaq, Here, the space in front of the mihrab was covered by a massive dome as large as mausoleum of Imam Shafii. Unfortunately, this magnificent wooden dome collapsed a long time ago. The mosque has three entrances, each entrance surmounted by the foundation slab.
The mosque has suffered greatly throughout its long history. During the French campaign in Egypt, the mosque was transformed (1798 - 1801) into a military fort ,Cannons were set up on the walls of the mosque, and its minaret was used as a defensive tower until it was destroyed. In 1812 , some of the mosque’s columns were moved to al-Azhar Mosque. Subsequently, the British army used it as a Military warehouse and then a slaughterhouse until 1915 .
Starting 1918, the Committee for the Preservation of Arab Antiquities repaired Some parts of the mosque, and undertook some restoration in the qibla riwaq .The Supreme council of Antiquities cooperated with Kazakhstan to restore the mosque, work went from 2007 to 2010, resumed in 2018, before reaching completion in 2022. Architectural and artistic elements were restored, as were wooden ceilings, and the foundations were reinforced. The groundwater water level was stabilised. New stone and marble flooring was installed in the mosque’s courtyard and arcades, during which an underground cistern was discovered beneath the courtyard.