Battle of Mers-el-Kébir (1507)

The Battle of Mers-el-Kébir took place between the Spanish Empire, and the native Kingdom of Tlemcen, near, and around Mers-el-Kébir

Background
The city of Mers-el-Kébir was captured by Spanish forces in 1505 in an effort to stop Barbary piracy. The city itself had to be maintained at a high cost, as an invasion by the local kingdom of Tlemcen was imminent. To balance this, Pedro Navarro himself led multiple raids into local Zayyanid towns, taking the population as prisoners and seizing all riches. The city of Mers-el-Kébir gained quite a large amount of money from such raids and as such continued launching them, with more and more troops. Of course Abu Abdullah V could not allow such incursions into his territory, and after meeting with multiple of his commanders, such as Ahmed Bin Ghanem, governor of Beni Rached, and Abu Abdullah Muhammad Ibn al-Sheikh al-Hajj, a sheikh of Tlemcen, he decided to rally an army of loyal tribes, from all over the country, including the tribes of Beni Rached led by Ahmed. Pedro, unaware of this, started organizing one of his largest raids, with over 3,000 troops.

Battle
In 1507 Pedro launched the raid into central Maghreb, plundering 3 villages near Mers-el-Kébir, and routing the resistance led by a local tribal chief. He captured more than 1,500 Moors whom he planned on selling as slaves, and more than 4,000 heads of Cattle. The routing tribes reported this to the local Zayyanid commander, who in turn notified the central army at Tlemcen. He himself launched an ambush against the Spanish plunderers, albeit he retreated after conceiving a few casualties. The main Algerian force arrived just in time, and after finding out the location of their Spanish foes, started organizing an ambush against them. In the Spanish camp itself, the captives were lightly defended, as the Spanish celebrated another flawless victory. The Zayyanids, after receiving reinforcements from the south led by bin Ghanem and from the local tribes, now boasted over 11,000 cavalry, albeit the majority of those were tribes, and even the main Zayyanid force had outdated equipment unlike the Spanish whom by now were equipped with Muskets. Regardless, the ambush was a major surprise to the Spanish who did not expect such a large army to attack them. Only about a thousand Spanish soldiers were able to escape, while the rest were slaughtered and caught. Those who escaped were not able to reorganize, and instead attempted to retreat back into the fort of Mazalquivir. The battle was a major defeat for Spain as they were overwhelmed both by the ruthless North African sun, and the large number of enemies. Upon hearing this, Ferdinand II, fearing the loss of Mers-el-Kébir, sent several squads of Galleys to Mers-el-Kébir, filled with troops and aid. Despite the precautions taken, the Zayyanids did not attack the city, instead retreating back into Tlemcen.

Aftermath
Following the defeat, Spain was confined to Mers-el-Kébir, until 1509, when they attacked Oran, achieving a great victory. The war was ultimately won by Spain in 1512, when the Zayyanid Sultanate became a vassal of the Aragonese crown but not for a long time until Abu Zayyan III get back Tlemcen from his brother Abu Abd Allah VI and against Spain with his garrison of Arab-Berber contingents and Spanish soldiers.