The Great Mosque of Mahdiya () is a mosque that was built in the tenth century in Mahdia, Tunisia. Located on the southern side of the peninsula on which the old city was located, construction of the mosque was initiated in 916, when the city was founded by the Fatimid caliph Abdallah al-Mahdi, to serve as the new city's main mosque. Most of the Fatimid-era city and its structures have since disappeared. The current mosque was largely reconstructed by archeologists in the 1960s, with the exception of its preserved entrance façade.

History
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. A site was chosen along the coast and construction of the new fortified palace city, al-Mahdiyya (Mahdia), began in 916. Construction of the Great Mosque, which served as the new city's congregational mosque, began that same year. The new city was officially inaugurated on 20 February 921, though construction continued after this. The new capital was probably chosen to place some distance between the Sunni population of Kairouan (the traditional capital of Ifriqiya), and the Fatimid Caliphs, who were Isma'ili Shi'as, so as to avoid raising tensions with the local population and to provide a more secure political and military base. 

The mosque was originally clad in marble, but much of this was removed during episodes when it was reduced to ruins and later rebuilt. It is possible that the Pisan church of San Sisto was built using marble that had been stripped from the mosque. The city of Mahdia underwent a period of relative abandon between 948, when the Fatimids to a new capital at al-Mansuriyya, and 1057, when the Zirid dynasty (successors to Fatimid rule), moved the capital back to Mahdia. In the 11th century the original qibla wall was destroyed by sea erosion and had to be rebuilt  to the north, thus reducing the size of the prayer hall. This work was probably done during the new Zirid occupation. A mihrab (symbolic niche in the qibla wall), documented by archaeologist Georges Marçais in a 1954 publication, was probably built during this period as well. 

In the late 11th century the prayer hall was extended northwards at the expense of the courtyard, resulting in the original southern portico of the courtyard being superseded by a newer construction of lesser quality. This extension of the prayer hall may have been motivated by the city's growing population during this period. It may also have been related to the 1087 raid and sack of the city by a Pisan-Genoese fleet, which could have necessitated repairs to the mosque. In 1550 Mahdia was captured by the forces of Charles V, who occupied it for several years, then destroyed its walls and withdrew. As the mosque shared some of its walls with the defensive walls of the city itself, it would have likely been heavily damaged as a result. Probably because of this, the prayer hall was mostly demolished and a new prayer hall, of small size and crude construction, was subsequently built in the middle of the mosque's courtyard, while the old prayer hall was briefly used as a cemetery. The mosque underwent further modifications and restorations prior to the 20th century, including a restoration by the Tunisian prime minister Yusuf Sahib at-Taba' circa 1798. 

Between 1961 and 1965 the mosque was completely renovated by the French architect and archaeologist Alexandre Lézine. The monumental access gate and portico in the north were preserved from the original structure, while the rest was reconstructed according to what archeologists believe was the original Fatimid form of the building.

Architecture

Exterior and courtyard
The building consists of a large irregular quadrilateral, about . It was built on an artificial platform "reclaimed from the sea" as mentioned by the Andalusi geographer Al-Bakri. The platform was necessary to provide a flat surface on the otherwise irregular terrain of the city's peninsula. The south side of the mosque, which houses the mihrab, is slightly longer than the north side. Seen from the exterior, the mosque looks like a fortress because of its massive stone walls without openings except in the façade.

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. 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,  from the city. The mosque originally had no minaret. The first tower-minarets were an innovation recently introduced under the Abbasid Caliphs, whose authority the Fatimids rejected. For these reasons, the early Fatimids rejected this architectural feature in their mosques. 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.

The main entrance, located in the center of the north wall, is a monumental portal projecting outward and rising taller than the surrounding structure. Its design and appearance is most likely derived from that of Roman triumphal arches in the region, like the Arch of Antoninus Pius at Sbeitla (Sufetula). The entrance is through a wide semi-circular horseshoe arch in the center, on either side of which are decorative niches: on the lower part of the façade the niches are shallow blind arches of horseshoe shape, while on the upper part they are deeper mihrab-like niches. Along the top is a narrow entablature. This entablature could have once contained an Arabic inscription, which may have been erased at a later period, but no evidence of any inscriptions from the original mosque has been preserved.

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. This section is attributed to the 11th century. There are some similarities between the straight-arris design of the groin vaults of the northern portico and the groin vaults at Cluny, Autun, Monte Cassino and Sant'Angelo in Formis which could be due to Burgundian influence. The other reconstructed arcades have arches on Corinthian columns.

Prayer hall 
The great hypostyle hall, dotted with Corinthian columns, consists of nine aisles perpendicular to the qibla and four bays. The aisles are separated by rows of arches resting, for the most part, on twin columns. The central nave, higher and wider than the others, is flanked by a row of thick twin arches, supported by groups of four columns instead of the twin columns used in the aisles. The central nave thus defines an axis within the hypostyle structure that leads to the mihrab. The intersection with a transept or transverse aisle, of equal magnitude and parallel to the qibla wall, results in a T-shaped plan, an architectural feature whose central point is the intersection of transept and nave in front of the mihrab niche. As this part of the original mosque had collapsed and disappeared long ago, this aspect of the layout relies partly on the conjecture of the archeologists who reconstructed it. 

As it was reconstructed recently, nothing remains of the prayer hall's original decoration. 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. It is an octagonal tholobate pierced with 24 windows. The load is carried by pendentives. 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. The lower level has nine vertical grooves ending in shell-shapes at their upper ends, above which are decorations of clover in high relief. Above the white marble band, the curving grooves converge at a single point at the top of the arch.

Influences
As a whole, the layout of the Great Mosque of Mahdiyya is closely related to that of the earlier (9th century) Great Mosque of Kairouan, with its courtyard surrounded by arcades and the "T-plan" layout of its hypostyle prayer hall. The major exception to this resemblance is the lack of a monumental minaret. Among later Fatimid mosques, the al-Hakim Mosque in Cairo, started in 990 and completed between 1003 and 1013, borrows from the Mahdiya mosque's design, with its projecting entrance and the wider and taller central aisle leading to the mihrab. The al-Azhar mosque in Cairo also seems to have had a similar projecting entrance. The Fatimid mosque at Ajdabiya in Libya had a similar plan, although it did not have the same monumental entrance. Like it, for the same ideological reasons, the Ajdabiya mosque did not have a minaret. The mosque built by the Mamluk sultan Baibars in 1266-1269 in Cairo has some external similarities to the Mahdiya mosque, with its long wall, corner buttresses and projecting gates.

Notes and references
Notes

Citations

Sources

Mosques in Tunisia
Mosque buildings with domes
Mahdiya
Buildings and structures in Mahdia
Fatimid architecture in Tunisia