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 Algerian kingdom of Tlemcen was imminent. To balance this, Pedro Navarro himself led multiple raids into local Algerian 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.