A naval campaign fought by mainly Pisan and Genoese forces against the Zïrid emirate in North Africa. It resulted in the temporary conquest of the city of Mahdia (mod. al- Mahdiya, Tunisia) with its suburb of Zawila. This enterprise has been seen as a kind of precursor of the First Crusade (1096-1099) and is described in a triumphal poem, the Carmen in victoriam Pisanorum, written by a Pisan cleric.
For Pisa and Genoa this campaign was one of a series of enterprises mounted against Muslim ports in the course of the eleventh century, often in retaliation for raids. It was organized by Pisa, at the request of the pope, with the aim of attacking theZïrid emir al-Tamīm ibn al-Mu‘izz (d. 1108), who had at his disposal the most powerful Muslim fleet in the Mediterranean. The Italian fleet was made up of about 300 Pisan, Genoese, and Amalfitan ships under the command of the Pisan viscount Hugo. It departed in 1087 and stopped at Rome, probably combining the campaign with a pilgrimage, which was probably meant as penitence for temporary support for Emperor Henry IV during his disputes with the papacy. When al-Tamīm’s fleet was too far away to defend the coastal cities, the Italian ships attacked and conquered the suburb of Zawila on the feast of St. Sixtus (6 August). It went on to capture Mahdia, al-Tamīm’s capital and principal port and an important emporium.
According to the Carmen in victoriam Pisanorum, the towns were offered to Roger I of Sicily, who declined because of his friendship with al-Tamīm. The fleet managed to impose a treaty of submission to the See of St. Peter on the emir, and Pisa and Genoa obtained some favorable trading rights in the Zīrid territories. Although Mahdia was not held for long and the enterprise did not have any major impact on the Muslims of North Africa, it may have served as an example of a successful “anti-pagan” campaign carried out in connection with a pilgrimage.