Mehdya (Arabic: المهدية, romanized: al-Mahdiyā), also Mehdia or Mehedya, is a town in Kénitra Province, Rabat-Salé-Kénitra, in north-western Morocco.
Mehdya was previously called Al-Ma'mura ("the well-populated") or La Mamora in Europe, and was a harbour on the coast of Morocco.
[3] During the first Anglo-Spanish War, pirates (including English former privateers) had sold captured prizes in Ireland and at the Barbary Coast, where governments struggled to prevent this trade.
[5] The only port on the Moroccan coast in the hands of neither the Spanish nor the Moors,[6] Mehdya became the main retreat of Atlantic pirates under the command of Henry Mainwaring,[7] important not only as a place to sell their plunder, but also for ship maintenance (including careening).
[11] After negotiations with Mulay Zidan, they left a strong garrison of 1,500 men, and called the harbour San Miguel de Ultramar.
[2] The works to build the Fortress of La Mamora along with the San Felipe bastion fort started immediately.
[12] The warlord Sidi al-Ayachi led a counter-offensive against Spain, privateering against its shipping, and obtaining the help of the Moriscos and the English.
[2][10] According to tradition, the Bishop of Cadiz had commissioned a statue of Jesus Christ for the church at La Mamora, which was in his diocese.