History of Algeria

ghrawa, Almoravid, Hammadid, Almohad, Merinid, Abdalwadid, Wattasid, Meknassa and Hafsid dynasties.
Barbary corsairs
The Spanish expansionist policy in North Africa began with the rule of the Catholic monarchs Isabella I of Castile and Ferdinand II of Aragon and their regent Cisneros. Once the Reconquista of the Iberian Peninsula was completed, several towns and outposts on the Algerian coast were conquered and occupied by the Spanish Empire: Mers El Kébir (1505), Oran (1509), Peñón of Algiers (1510) and Bugia (1510). The Muslim leaders of Algiers called for help from the Barbary corsairs Hayreddin Barbarossa and Oruç Reis, who previously helped Andalusian Muslims and Jews escape from Spanish oppression in 1492. In 1516, Oruç Reis conquered Algiers with the support of 1,300 Turkish soldiers on board 16 galliots and became its ruler, with Algiers joining the Ottoman Empire.
The Spaniards left Algiers in 1529, Bugia in 1554, Mers El Kébir and Oran in 1708. The Spanish returned in 1732 when the armada of the Duke of Montemar was victorious in the Battle of Aïn-el-Turk; Spain recaptured Oran and Mers El Kébir. Both cities were held until 1792, when they were sold by King Charles IV of Spain to the Bey of Algiers.
Algeria was made part of the Ottoman Empire by Hayreddin Barbarossa and his brother Aruj in 1517. After the death of Oruç Reis in 1518, his brother succeeded him. The Sultan Selim I sent him 6,000 soldiers and 2,000 janissaries with which he conquered most of the Algerian territory taken by the Spanish, from Annaba to Mostaganem. Further Spanish attacks led by Hugo of Moncada in 1519 were also pushed back. In 1541, Charles V, emperor of the Holy Roman Empire, attacked Algiers with a convoy of 65 warships, 451 large ships and 23,000 men, 2000 of whom were mounted. The attack resulted in failure however, and the Algerian leader Hassan Agha became a national hero as Algiers grew into a center of military