The mosque was commissioned by the Fatimid vizier Tala'i ibn Ruzzik in 1160. Tala'i was one of the last powerful and competent viziers who maintained a level of stability in the Fatimid Empire in its last decades. As the Fatimid Caliphate was dissolved in 1171, this mosque is the last major Fatimid monument to have been built. The Fatimid dynasty were Isma'ili Shi'aMuslims claiming descent from the Prophet Muhammad, and the mosque was originally built to be the resting place of the head of Husayn, the son of 'Ali, who was slain at the Battle of Karbala in 680 and is revered as a martyr by Shi'as. His head was originally believed to be interred at Ascalon, but it was brought to Cairo in 1153 when Ascalon was threatened by Crusaders. However, the head ended up being kept in a shrine at the Fatimid palace instead, the site of which later became the al-Hussein Mosque where the shrine remains today.
Foundation and elements from the Fatimid era
The mosque was constructed on a raised platform whose base, at street level, had built-in recesses on three sides designed to host shops which contributed to the revenue of the mosque. It was thus the first "hanging" mosque in Cairo, which is to say a mosque where the prayer space is raised above street level. The entrance to the mosque is fronted by a portico with five arches, a feature which was unique in Cairo and might have been intended for some ceremonial purpose if the head of Husayn had been buried here as intended. Originally, a minaret also rose above the entrance of the mosque; the visible stairwell that still leads to the roof today probably marks its former location. The mosque's interior features a courtyard surrounded by an arcade of keel-shaped arches, with the qibla side extending deeper to form a prayer hall with three rows of arches instead of one. The Fatimid decoration of the mosque includes blind keel-shaped arches on the outside facade, while the interior displays carved wooden tie-beams between columns, Qur'anic inscriptions in Kufic style on the outlines of the arches in the prayer hall, and window grilles carved in stucco. Some of these decorative elements continued to appear in post-Fatimid architecture in Cairo. The capitals of the columns in the prayer hall are all re-used from pre-Islamic buildings.
The mosque was restored in the Mamluk era after an earthquake in 1303 which destroyed the minaret that stood over the front porch of the mosque. At this time bronze facings in the Mamluk style were added to the original main doors which had been carved in wood. Today the doors are replaced by replicas while the originals, featuring both the Mamluk bronze-faced and Fatimid wood-carved facades, are on display at Cairo's Museum of Islamic Art. The Mamluk restoration also added wooden mashrabiyya screens to the portico fronting the mosque. The minbar inside the mosque also dates from the Mamluk era and was a gift of the Mamluk amir Baktimur al-Jugandar. It has excellent craftsmanship and is one of the oldest surviving minbars in Cairo. Today, the base of the mosque is nearly two metres below the current street level, illustrating how much the street level has risen in the city since the 12th century.