Mahdia campaign of 1087

The Mahdia campaign of 1087 was a raid on the North African town of Mahdia by armed ships from the northern Italian maritime republics of Genoa and Pisa.

Mahdia had been the capital of Ifriqiya under the Fatimids, chosen due to its proximity to the sea which allowed them to conduct naval raids and expeditions such as the raid on Genoa in 935. After the Fatimid conquest of Egypt, the region was under the control of the Zirids who remained part of the Fatimid Caliphate until 1048 when the Zirids renounced Shia Islam. In response, the Fatimids send the Arab tribes to Ifriqiya to subdue the revolt. As a result of the ongoing fighting and anarchy, the previously flourishing agriculture decreased and the coastal towns became more important as both centers for maritime trade as well as bases for piracy against Christian shipping.

The raid had been prompted by the actions of the Zirid ruler Tamim ibn Muizz (reigned 1062–1108) as a pirate in waters off the Italian Peninsula, along with his involvement in Sicily fighting the Norman invasion. In this context, Tamin had ravaged the Calabrian coast in 1074, taking many slaves in the process, and capturing temporarily Mazara in Sicily in 1075 before negotiating a truce with Roger that ended Tamin's support for the emirs of Sicily.

These campaigns and raids by other Arab pirates threatened the growing economic interests of the Italian maritime republics and thus provided motivation for attacking the Zirid stronghold. This had led the Pisans to engage in military action before Mahdia, such as in briefly seizing of Bone in 1034 and military aiding the Norman conquest of Sicily in 1063.

The attack was led by Hugh of Pisa, with military aid from Rome and the Genoese navy; the nobleman Pantaleone from Amalfi was also possibly involved, and the whole endeavour had the backing of Matilda of Tuscany. Most likely no cavalry was used as neither Latin nor Arab sources mention horses or cavalry, pointing out that capabilities to transport horses on long distance journeys was at this time beyond the capabilities of the Italian republics. The united forces succeeded in capturing the city, burning Mahdia's fleet as well as extracting from Tamin an indenmity which was shared between Pisa and Genoa. As they could not hold the city, it was possibly offered to Roger of Sicily, who refused due to the treaty he had made with Tamin earlier. A big part of the indemnity was spent on the cathedral at Pisa and to build a new church dedicated to St. Sixtus. Among the captured goods may have been the Pisa Griffin, the largest medieval Islamic metal sculpture known. Tamin seems to have been also forced to not attack the Christians again and release his captives. The city was

Crusade historian Carl Erdmann considers the raid a direct precursor to the First Crusade ("ganz als Kreuzzug ausgeführt") which occurred eight years later, as it was conducted under the banner of St. Peter against a Muslim ruler who was demonised in the accounts of it, and a form of indulgence was granted to the campaigners by Pope Victor III. On the other hand, Alasdair Grant makes the point that references to the papacy are scanty and ambiguous. However the case, it may well be argued that the destruction of the naval forces of Mahdia contributed to the success of the First Crusade by allowing the supplying of Outremer by sea.