Conflict with the Fatimids
Mahdia, TunisiaThe 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.
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 economics 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.