Invasion of Algiers (1775)

The Invasion of Algiers was a massive amphibious attempt in July 1775 by the Spanish to seize the city of Algiers (then under Ottoman rule) and its enclaves responding to a Moroccan siege of the Spanish possession of Melilla by Sultan Mohammed III a year previously. King Charles III ordered an invasion of Algiers led by Alexander O'Reilly, who commanded a combined military and naval expedition of nearly fifty ships and more than twenty thousand troops. The assault was a spectacular failure and the campaign proved a humiliating blow to the Spanish military revival, and it further empowered the Moroccan sultanate.

Background
After the Spanish had broken the Moroccan siege of Melila in 1774 Charles's government decided to send a military and naval expedition off the North African coast, as he was determined to demonstrate to the Sultan Mohammed III that Spain would not waver in its resolve to hold onto its Moroccan enclaves. The Spanish objective was to occupy Algiers; a key and supposedly vulnerable Barbary port. The expedition was commanded by Alexander O'Reilly, an Irish officer who at a young age had entered Spanish military service. As head of the royal household guard in 1765, he had protected Charles III from a deadly assault and had crushed the rebellion by French settlers in the Louisiana Rebellion of 1768 after the territory had been transferred from France to Spain in 1763. In command of the naval task force was Don Pedro Gonzalez de Castejon with and together they organized a task force by late spring.

Assault
By now in June the task force was enormous; Seven ships of the line of which included San Francisco de Paula, Oriente, San Rafael, Diligente and San José. Then in addition twelve frigates, 27 gun boats, five hulks, nine feluccas, four mortar boats, seven galleys and three other vessels along with 230 transports. 20,000 Soldiers sailors and marines completed the complement and it set course from Cartagena, Spain for the Bay of Algiers, reaching its objective by the beginning of July.

The Spanish troops landed in two waves, overwhelmed by sweltering summer heat. Antonio Barceló protected the landing craft as it approached but with the bays shallow water he stuck to the coast as close as possible so that the naval artillery was more effective. Despite the strict instruction that O'Reilly instilled in his troops, the Spanish mistakenly chose the landing area and the heavy guns were stuck fast in the dunes of the beach making them totally unusable for combat. Once ashore however the Spanish were met initially with light resistance mainly because a feigned retreat by the forces from Algiers. The latter had been massively augmented by warrior tribesmen from the interior, who had been alerted by intelligence from Berbar merchants in Marseilles who had followed the course of Spanish military preparations during the spring.

By now the Spanish had realized the position they were in and the trap was set by the Algerines. Once the Spanish had realised they were surrounded it was too late Unable to hold a line of resistance, the Spanish forces were routed, returning in chaos to their ships. The losses were huge; nearly 3,000 casualties, including five generals killed and fifteen wounded (one of these being Bernado de Galvez) and then abandoning to the Algerians no fewer than 15 guns and some 9000 other weapons. Henry Swinburne records that the Spanish would have been "broken and slaughtered to a man... had not Mr. Acton, the Tuscan commander, cut his cables, and let his ships drive in to shore just as the enemy was coming on us full gallop. The incessant fire of his great guns, loaded with grape-shot, not only stopt them in their career, but obliged them to retire with great loss". The Spanish had lost many prisoners as many were cut off from returning to their ships. O'Reilly had to wait for a month to negotiate their return. He then wanted to retaliate by bombarding Algiers from the sea, but he learned that he had only enough provisions on board to last for an immediate return to Spain. O'Reilly and the Spanish fleet withdrew to Alicante with it his reputation was now in tatters.

Aftermath
Although in general Charles III's reforms of the Spanish military would enhance his country's military position, O'Reilly's poor preparations and leadership made the Algiers defeat a mockery of the Spanish army. While the Algerines had detailed intelligence on the Spanish, the Spaniards had no information about them. Where Spain had mostly raw recruits, the Algerians had veteran warriors. The Algerians confronted the Spanish with a united force, whereas O'Reilly and the commander of the Spanish ships had many differences in particular between the navy and the army. This bitterness resulted in an extraordinary lack of planning, which in turn left O'Reilly with inadequate provisions and armaments. O'Reilly proved incapable of coordinating the varied elements of his forces. Popular discontent over the humiliating defeat at Algiers forced Charles to save his commander's life by spiriting him away to remote commands.

Further changes occurred when Charles appointed the Count of Floridablanca as his foreign minister in 1777. Supervising Spain's foreign affairs for fifteen years, Floridablanca became one of the most effective and respected of Bourbon public servants. Despite the Algiers invasion, in 1780 Spain and Morocco signed a treaty of friendship at the Peace of Aranjuez in 1780. Mohammed III recognized that his own interests in Algeria would move forward only if he had Spanish support. In 1785, the sultan demonstrated the extent of his influence in Algiers by sponsoring a treaty between Spain and Algeria after the Spanish attempted twice to bombard Algiers of which were also met with defeat. The tensions Spain had chronically encountered along the Barbary Coast were reduced. It was now left for European nations to deal with the Barbary pirates and prevention of slavery in particular the bombardment of Algiers in 1816 by the Royal Navy and Dutch fleet and then when it was vaporized when France finally conquered Algeria in the 1830s.