In 912 the first Fatimid imam and caliph, Abdallah al-Mahdi, began looking for the site of a new capital for his newly established state in Ifriqiya.
[7] In the 11th century the original qibla wall was destroyed by sea erosion and had to be rebuilt 6.2 metres (20 ft) to the north, thus reducing the size of the prayer hall.
A mihrab (symbolic niche in the qibla wall), documented by archaeologist Georges Marçais in a 1954 publication,[a] was probably built during this period as well.
[b] The two projecting bastions at the front corners of the mosque were once thought to be the bases of former minarets, but were actually above-ground cisterns for collecting rainwater from the roof, stored for usage during ablutions.
[1] It is likely that, at least for some time, they were fed by the aqueduct that served al-Mahdi's palace from underground sources at Miyyanish, 6 kilometres (3.7 mi) from the city.
The call to prayer would have most likely been given from the doorway or the roof of the mosque, according to a tradition going back to 'Ali and favored by Shi'a Muslims at the time.
[1][17] The main entrance, located in the center of the north wall, is a monumental portal projecting outward and rising taller than the surrounding structure.
Inside is a large courtyard surrounded by porticos or arcades (riwaqs) on all four sides, an arrangement typical of mosques in the region.
The northern portico consists of an arcade resting stone pillars and preceding a gallery covered by groin vaults.
[1] Open to the axis of the nave through a horseshoe arch, the central area is defined by pillars and half-pillars in angles and bundles, formed of groups of columns, on which rests a hemispherical dome.
A band of black marble decorated with inscriptions from the Quran marks the transition between the two complex structural forms.
The mihrab, made of white stone, has the shape of a horseshoe and is supported by two columns of dark green marble.
The sculptural decoration inside the mihrab consists of two levels separated by a band of white marble carved with Qur'anic verses in Kufic characters.