The Mahdia campaign of 1087 was an attack on the North African town of Mahdia by armed ships from the northern Italian maritime republics of Genoa and Pisa. It 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. The attack was led by Hugh of Pisa, with military aid from Rome and the Genoese navy; the nobleman Pantaleone from Amalfi was also involved, and the whole endeavour had the backing of Matilda of Tuscany. It succeeded in capturing the city, but they could not hold it; the money from the plunder was spent on the cathedral at Pisa and to build a new church.
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.
The main source of information for the campaigns is the Carmen in victoriam Pisanorum, written within months of it by a Pisan religious cleric.
- Cowdrey, H. E. J. "The Mahdia Campaign of 1087." The English Historical Review, 92:362 (January 1977), 1–29.
- Erdmann, Carl. The Origin of the Idea of Crusade, tr. Marshall W. Baldwin and Walter Goffart. Princeton University Press, 1977.
- Grant, Alasdair C. "Pisan Perspectives: The Carmen in victoriam and Holy War, c.1000–1150". The English Historical Review, 131:552 (October 2016), 983–1009.