Expedition of Mostaganem ( 1558 ) The Expedition of Mostaganem occurred in 1558 , when Spanish forces attempted to capture the city of Mostaganem , in modern Algeria , from the Ottomans . The expedition was supposed to be a decisive step in the conquest of the Ottoman base of Algiers , but it ended in failure , and has been called a " disaster " . Background . The harbour of Mostaganem had been captured by the Spanish from the Muslims in 1506 . The harbour became part of numerous Spanish possession on the North African coast , which had been captured since 1496 : Melilla ( 1496 ) , Mers - el - Kebir ( 1505 ) , Oran ( 1509 ) , Bougie ( 1510 ) , Tripoli ( 1510 ) , Algiers , Shershell , Dellys , Tenes . In 1516 , Mostaganem was seized by Hayreddin Barbarossa from his base of Algiers , who then strengthened its defences . The city then became a rival of Oran . From 1519 , Barbarossa placed himself under the protection of the Ottomans , thereby transforming Mostaganem into an Ottoman dominion . Previous Spanish expeditions had taken place in 1543 and 1547 , which failed as the Spanish forces were repulsed and then pursued in retreat by Turkish and tribal forces . The expedition of 1558 to retake Mostaganem from the Ottomans followed a string of Ottoman successes in the Mediterranean , especially with the Siege of Tripoli in 1551 , and the evacuation of Al - Mahdiyeh by the Spaniards . Concurrently , the corsairs of Barbary were operating from their base in Algiers . Ottoman - Moroccan conflict . In 1556 , the Ottomans of Algiers had besieged Oran , although unsuccessfully , while in the meantime the Moroccans seized the opportunity to capture Tlemcen from the Turks . In 1557 , the Ottomans demanded the submission of Morocco to the Ottoman Empire , but murdered the Moroccan ruler Mohammed ash - Sheikh , who was collaborating with Spain , when he refused . In March 1558 , the Ottomans under Hasan Pasha , the son of Barbarossa and ruler of Algiers , had invaded the Moroccan territory toward Fez , but were stopped at the indecisive Battle of Wadi al - Laban just north of Fes . The Ottomans retreated when they learned about Spanish preparations for an offensive in Oran . Expedition . An elite contingent , numbering 6 , 500 , was dispatched from Málaga by Philip II of Spain , and concentrated at the Spanish base of Oran to join local Spanish troops and the Moroccan " Goum " troops of the Caïd of Tlemcen , Abdallah al - Ghalib . They departed from Oran on 22 or 26 August 1558 . The Spanish expedition first successfully managed to capture . They then attacked Mostaganem but were repulsed . With supplies running low , they learnt that Hasan Pasha was arriving from Algiers with a relief force of about 6 , 000 troops . This led to a panic retreat by the Spanish troops . In the end , around 12 , 000 Spanish soldiers were taken prisoner . Count Alcaudete , Governor of Oran , died in the expedition . His son Don Martín de Córdoba , himself future Governor of Oran , was also captured in the disaster and would be imprisoned as a Christian slave in Algiers under the " beylerbey " Hasan Pasha , until he was exchanged for the huge ransom of 23 , 000 " escudos " . The failure of the expedition of Mostaganem ended attempts at a grand alliance between Spain and Morocco against the common Ottoman enemy .