Military history of Spain

The military history of Spain, from the period of the Carthaginian conquests over the Phoenicians to the former Afghan War spans a period of more than 2200 years, and includes the history of battles fought in the territory of modern Spain, as well as her former and current overseas possessions and territories, and the military history of the people of Spain, regardless of geography.
Spain's early military history emerged from her location on the western fringes of the Mediterranean, a base for attacks between Rome and Carthage. With the fall of the Roman Empire, Spain was devastated by successive barbarian invasions, with stability only gradually appearing with the later years of the Visigothic kingdom. The early Middle Ages for Spain saw the country forming the front line in a battle between Christian and Islamic forces in the Mediterranean; the Conquista and Reconquista took centuries to reach a military resolution. The period from 1492, when the Reconquista was completed and the Spanish colonization of the Americas began, to the late 17th century is known as the Spanish Golden Age. Spain acquired a vast empire by defeating the centralised states of the Americas, and colonising the Philippines. Her tercio units, backed by imperial gold and silver, were involved in most of the major wars of the period. It was not until the years after the Thirty Years' War that Spanish military power began to fade; even then, supported by a reinvigorated navy, Spain remained a major military power throughout the 18th century, in competition with Britain and France on the global stage.
The Napoleonic Wars changed Spanish military history dramatically; the Peninsular War saw the development of guerrilla warfare against the occupying French forces. The collapse of central Spanish authority resulted in successful wars of independence amongst Spain's American colonies, drastically reducing the size of her empire, and in turn led to a sequence of civil wars in Spain itself, many fought by frustrated veterans of the French and colonial campaigns. Attempts to reassert imperial power during the mid-19th century, enabled by the development of the steam frigate ultimately failed, leading to the collapse of the remnants of Spain's empire in the Americas and Asia in 1898 at the hands of a rising power, the United States of America. The political tensions that had driven the Carlist Wars remained unchecked, spilling over once again in the Spanish Civil War of 1936–39. Bringing a foretaste of the tactics of the Second World War, several nations used the conflict as a testing ground for new aerial and armoured warfare tactics. In the post-war period, Spain has increasingly turned away from the last remaining colonial conflicts in Africa, and played a growing modern military role within the context of the NATO alliance.
In the classical period, Spain was a mix of Celtic and Iberian tribal states, and Greek and Phoenician trading ports, with the largest state being the kingdom of Tartessus. With the eruption of war between Carthage, a Phoenician colony in North Africa and the Greeks, the Carthaginians begin extending their influence in Iberia, creating the city of New Carthage (Cartagena), in hopes of creating a trading empire. Following the First Punic War with Rome, in 237 BC, Hamilcar Barca, the famous Carthaginian general, then began the conquest of Turdetania (the successor state of Tartessus) and Gades to provide a springboard for further attacks on Rome. Hamilcar entrusted the conquest and military governance of the region to his son Hasdrubal the Fair – his other son, Hannibal, would march his troops across Hispania with elephants to lead them on Rome in the Second Punic War. During that war, Rome declared Hispania to be a Roman provincia in 218 BC, beginning a century-long campaign to subdue the people of Iberia to Roman.
After the expulsion of the Carthaginians from Hispania in the Second and Third Punic Wars, Rome attempted to subdue the native tribes. In the northeasterly province of Hispania Citerior, the Celtiberian Wars occupied Roman forces for the better part of the 2nd century. In Hispania Ulterior, the Lusitanian War did the same. The resistance of the Lusitani under Viriathus became legendary across the Empire. In the troubled final years of the Republic, Quintus Sertorius held most of Iberia as a de facto independent sovereign against the partisans of Sulla. His attitude towards the natives and his military reforms – he was a partisan of Marius – secured him the loyalty of the populace and the army and his general success until his assassination. The Spanish era, a dating system predominant in Iberia until the close of the Middle Ages, began in 38 BC. The last region of Hispania to be subjected was the northwest, finally being conquered in the Cantabrian Wars, which ended in 19 BC.
Under Roman rule, Hispania contributed, like the rest of empire, to the Roman military, providing auxiliary forces, in particular alae cavalry, and later legionaries, . Hispania also shaped Roman military affairs more subtely. The original Roman Gladius, the Gladius Hispaniensis, stemmed directly from the Celtiberian infantry sword used in Carthaginian Spain; this would form the basis of the Roman weapon for several centuries. Some of Rome's most famous military Emperors, including Trajan, Hadrian and Theodosius, were born in Hispania.
During the 3rd through 6th centuries, the Roman Empire was beset by numerous barbarian invaders, mostly Germanic, who migrated through its borders and began warring and settling in its territories. While the Vandals and Alans were fighting each other for supremacy in southern Gaul, the confederation of the Suevi crossed the Pyrenees and passing through Vasconia, entered Gallaecia in 409. The Vandals soon followed the Suevi example, with the Alans close behind. The Alans settled in Lusitania and Carthaginiensis and the Siling Vandals in Baetica, while the Asding Vandals vied with the Suevi for Gallaecia. The Visigoths crossed the Pyrenees to expand their kingdom in 416. They pushed the Vandals and Alans south, defeating and killing the Alan king Attaces in 426 and forcing the two tribes to amalgamate and retreat across the Straits of Gibraltar into Africa. For almost thirty years, Spain was the location for vicious tribal conflicts.
The first barbarians to settle were the Suevi, whose king Hermeric, a former foederatus of Rome, ratified a peace with the local Hispano-Roman population in 438. Weary of fighting, Hermeric abdicated in favour of his son Rechila. As the Visigothic kingdom expanded into Iberia, expelling the Vandals and Alans, the Suevi expanded their own realm as far south as Mérida. In 456, the new Catholic king, Rechiar, died in battle with the Visigoth king Theodoric II and the Suevi kingdom began to retreat under Gothic pressure. Beset by internal political conflict, the Suevi capitulated to the Visigoths in 585. Some resistance was maintained for a few years, but soon the last of Suevi resistance was erased.
The Visigoths consolidated a kingdom spanning most of Iberia and Gaul. For the next two centuries, they warred not only amongst themselves in a sequence of succession crises – which followed the election of a new king after every royal death, but also against the Byzantine Empire, which was trying to regain lost territory in the south, the Arian Suevi trying to preserve their hold on Gallaecia, and the Franks pushing south against them from Gaul. The Visigoth military structure was highly decentralised – the great territorial magnates, the duces (dukes), maintained their own armies, as in all the great Germanic kingdoms of Europe at the time. These armies rarely cooperated in campaigns. At the Battle of Vouillé in 507, the Franks under Clovis I wrested control of Aquitaine from the Visigoths. The Visigoths lost all of their territory north of the Pyrenees except the province of Gallia Narbonensis. The first half of the 6th century was largely a failure for the Visigoths. They failed to hold onto their Gallic possessions, they failed to oust the Suevi, and they failed to repulse the Byzantine Empire when it first endeavoured to reassert control over its Iberian provinces, taking advantage of a local rebellion. In 554, Granada and southernmost Hispania Baetica were taken from the Byzantines; under the last Arian king, Leovigild, the Suevi kingdom was annexed in 585 and the war of reconquest against the remainder of the Byzantine territories was begun, finally being completed under King Suintila in 624. The Visigoths faced no serious external threat from then on until the sudden Moorish invasion of 711.
For almost seven hundred years, Spain was the battleground for the opposing forces of the Islamic Caliphate and Western Christian forces. Both Muslims and Christian were motivated by religious conviction, which inspired the warfare. The initial Islamic invasion of Iberia was sudden and unexpected. The varied Moorish tribes of Morocco united under the leadership of Arab generals sent by the reigning Umayyad caliph and crossed the Straits of Gibraltar in 711 under the leadership of the Berber Tariq ibn Ziyad. Tariq won a swift victory at the Guadalete and defeated and killed the reigning Gothic king, Roderic. In a campaign lasting eight years, the whole of Iberia was subjected to Umayyad authority, except for the Asturias mountain range in the far northwest and the pockets of resistance in Navarre. The Islamic offensive ultimately paused after the losses it suffered in Frankland and in the Asturias, where battles such as those at Tours and Covadonga showed some of the potential weaknesses of the Arab methods of warfare.
The Islamic conquest was only very slowly undone, over the course of seven centuries in what the Christians of Spain called the Reconquista. Three main forces were involved in this process, the Visigothic holdouts in the Asturias, the holdouts in Navarre and the Pyrenees, and the Franks of Aquitaine. The Reconquista, as a concerted effort to remove the Muslims from the territories they held, commenced in the reign of Alfonso I (739–757). Alfonso led an offensive into the valley of the Duero and left the region depopulated, the so-called "Desert of the Duero". For the next century, this prevented any serious Islamic incursions into the Christian territories of the north. During the late 8th and early 9th centuries, the Franks under their Carolingian rulers took up the cause of reconquest along the Mediterranean littoral. By 797, Charlemagne's son, Louis the Pious, captured Barcelona, establishing a clear bulwark against future invasions. The Basques extended their kingdom as far as Nájera, and a widespread repoblación of the depopulated areas began, extending Christian borders southwards.
Despite a resurgence during the 10th century, the Caliphate of Córdoba's attempts to reverse the Reconquista failed, and by the 11th century, Christian Iberia was united under Sancho the Great, the King of Navarre, whilst the caliphate was divided and engulfed by civil war, the period of the taifas. The 11th century saw the development of a concept of Christian holy war, to be waged against Islam with the purpose of the Christians recapturing long lost territories – the Crusade. Crusading, under other names, also took place in Spain; Franks and Normans and even Papal troops took to Spain in increasing numbers to join the locals in their fight against "the Moor." The last threat of the 11th century came in the form of the Almoravids, who with their well disciplined forces first established a hegemony over Morocco and then extended it over al-Andalus. While the Reconquista paused in the west, to the east Alfonso the Battler, the King of Aragon, redoubled efforts to retake the valley of the Ebro. In 1212, the Reconquistadores gained a decisive victory over the Almohads at the Battle of Las Navas de Tolosa. Shortly after the battle, the Castilians took Baeza and, then, Úbeda, major fortified cities near the battlefield, and gateways to invade Andalucia. Thereafter, Ferdinand III of Castile retook Córdoba in 1236, Jaén in 1246, and Seville in 1248; then he took Arcos, Medina-Sidonia, Jerez and Cádiz, effectively bringing the bulk of the reconquista to a conclusion.
Late medieval Spain was divided into the three Christian kingdoms of Navarre, Castile and Aragon, alongside the small, last remaining Islamic state of Granada. The civil wars and conflicts of the late 14th and early 15th century would result in the unification of the Christian kingdoms; combined with advances in naval technology, this would pave the way for the rise of Spain as a dominant European power.
Castile, a medium-sized kingdom with a strong maritime tradition, was plunged into civil war following the death of Alfonso XI in 1349; the conflict between Pedro of Castile and Henry II of Castile became bound up with the wider politics of the Hundred Years' War. With France supporting Henry and his descendants, England made efforts to weaken his regime. Attempts by John I, Henry's son, to unify Castile and Portugal, resulted in a Portuguese uprising and the intervention of the English commander John of Gaunt, claiming the Castilian throne by right of marriage. Not until 1387 was the civil war finally concluded, with John of Gaunt accepting a cash settlement. Aragon, a smaller kingdom but with widespread claims to lands across the Mediterranean, also saw internal clashes over dynastic inheritance; Peter IV fought a harsh campaign against his nobles from 1346 to 1349 over his daughter's right to inherit the throne.
The threat of internal stability remained until the marriage of Queen Isabella I of Castile and King Ferdinand II of Aragon in 1469. The two monarchs were promptly challenged by Joan of Castile but were swiftly successful. Isabella would go on to establish the Hermandad militia system, which would provide her with a royal counterbalance to any future challenge from the nobility. The two monarchs proceeded to conquer the Kingdom of Granada, the last Islamic state in the Iberian peninsula, which was completed by 1492. In that same year, the Alhambra Decree was issued, expelling all Jews from both Castile and Aragon. Now unified, Spain now enjoyed relative internal stability; rights and lands across the Mediterranean; and a strong tradition of seafaring in both the Atlantic and Mediterranean, which it would maximise in the coming decades.
After Christopher Columbus's successful navigation to the New World under Spanish patronage, Spanish forces rapidly began to occupy much of the new territories, rapidly taking the Bahamas and effectively destroying the local Arawak speaking indigenous groups. The efforts of Ferdinand Magellan, reaching the island of Limasawa in 1521, led to the subsequent establishment of the colony of the Philippines under Miguel López de Legazpi which was to become an essential Spanish military base in the Pacific. The challenge of the Barbary Pirates encouraged defensive and punitive expeditions across the Mediterranean, resulting in the conquest of various outposts in North Africa, including Melilla in 1497, Mazalquivir in 1505, Oran in 1509, Algiers in 1510, Tripoli in 1511 and the smaller Plazas de Soberania.
The most dramatic impact of Spanish military power, however, lay in the defeat of the American empires of the Aztecs and Incas. From 1519 to 1521, a coalition army of Spanish soldiers and Tlaxcalan warriors led by Hernán Cortés and Xicotencatl the Younger defeated the Aztec Empire; in 1532, Francisco Pizarro and his brothers Gonzalo and Hernando invaded and occupied the Inca Empire from their base in Panama. Both wars in which very small numbers of Spanish soldiers – the conquistadors – who were mostly veterans of Spain's European or North African campaigns, were backed by local allies and defeated well established empires, shared many similarities. The highly proficient conquistadors benefited from their access to cavalry, steel swords, axes, spears, pikes, halberds, bows, crossbows, helmets and armour, not to mention small cannon, none of which were familiar to local forces. The Spanish also benefited from their immunity to many common European diseases which were to decimate their local enemies.
Spain had one of its worst military defeats in the War by Fire and blood (also known as the Chichimeca war). They were defeated by the native allies of the Great Chichimeca north of the Aztec empire. This war was very distinct considering the natives created arrows that were very effective at penetrating armor. They had to pay the natives for peace.
The Spanish were to fare less well against the less centralised societies of southern Chile, however, particularly once local forces began to adapt to, or actually adopt similar military technologies. Although Pedro de Valdivia was able to successfully invade Chile in 1540, the first great rebellion of the Arauco wars was to begin only 1553 later, marking the beginning of a conflict that would last until the 19th century. Spanish forces, operating at huge distances from their European or even Caribbean centres of power, were frequently available in small numbers; Valdivia had great difficulty in recruiting even the 150 Spanish soldiers he used to invade Chile, and the frequent reversals during the Arauco wars led to losses that often took several years to replace. As time progressed, the advantages of the Spanish began to increasingly centre on their access to early modern firearms, especially the musket, rather than the technologies that had won them their early successes.
During the 16th and 17th centuries, Habsburg Spain (1516-1700) saw a steady growth in its military power. The Italian Wars (1494–1559) resulted in an ultimate Spanish victory and hegemony in southern Italy and in the Duchy of Milan by expelling the French. During the war, the Spanish army transformed its organization and tactics, evolving from a primarily pike and halberd wielding force into some of the first pike and shot formation of arquebusiers and pikemen, known as the colunella. During the 16th century this formation evolved into the tercio infantry formation. The new formation and battle tactics were developed because of Spain's inability to field sufficient cavalry forces to face the heavy French cavalry. Habsburg Spain came to enjoy an axis of allied and neutral territories from Naples through Milan and northwards to the Netherlands, a route for reinforcements that came to be called the Spanish Road. Backed by the financial resources drawn from the Americas, Spain could afford to mount lengthy campaigns against her enemies, such as the long running Dutch revolt (1568–1609), defending Christian Europe from Ottoman raids and invasions, supporting the Catholic cause in the French civil wars and fighting, England during the Anglo-Spanish War (1585–1604).
By one modern estimate, the Spanish army in 1625 was 230,000 regulars (80,000 in field armies, 150,000 in garrisons), exclusive of naval personnel and militia. By another the Spanish army grew in size from around 20,000 in the 1470s, to around 300,000 by the 1630s during the Thirty Years' War that tore Europe apart, requiring the recruitment of soldiers from across Europe. King Philip IV himself stated in 1626: "Last year, 1625, we had nearly 300,000 infantry and cavalry in our pay, and over 500,000 men of the militia under arms, whilst the fortresses of Spain are being put into a thorough state of defence. The fleet rose at one time in 1625 to 108 ships of war at sea, without counting the vessels at Flanders, and the crews are the most skillfull mariners this realm ever possessed. This very year of 1626 we have had two royal armies in Flanders and one in the Palatinate, and yet all the power of France, England, Sweden, Venice, Savoy, Denmark, Holland, Brandenburg, Saxony, and Weimar could not save them from our victorious arms."
With such numbers involved, Spain had trouble funding the war efforts on so many fronts. The non-payment of troops led to many mutinies and events such as the Sack of Antwerp (1576), when unpaid tercio units looted the Dutch city. Spain's holdings in Italy and the Low Countries contributed large amounts of men and treasure to the empire's army: each province was allotted a number of troops it had to pay for (including the ethnic Spanish garrisons) and recruits it had to provide. Troops were generally sent outside of the areas they were recruited in. From 1635 to 1659, the Duchy of Milan provided 100,000 soldiers to the Spanish army, while the Kingdom of Naples provided 53,500 (plus a naval expedition) from 1631 to 1636 alone.
In the east, Habsburg Spain fought alongside other Christian allies against the Ottoman Empire, taking part in numerous actions and campaigns in and around the Mediterranean over the period. The naval competition culminated in victory for the Christian alliance at the battle of Lepanto in 1571, the last naval battle in the Mediterranean to see the large scale use of galleys by both sides. In the middle of the century, Spain developed the galleon for naval warfare, using them in convoys to link her possessions in the Philippines, the Americas and Europe. The Manila galleons sailed once or twice per year across the Pacific Ocean, whilst the Spanish treasure fleets linked Mexico back to Europe.
Spain fought the Castilian War against the Bruneian Empire. Spanish forces attempted to conquer Cambodia in the Cambodian–Spanish War but were defeated. The Moros fought against the Spanish invasion for centuries in the Spanish–Moro conflict. The Igorot people resisted and fought against the Spanish.
The Thirty Years' War (1618–1648) drew in Spain alongside most other European states. Spain entered the conflict with a strong position, but the ongoing fighting gradually eroded her advantages; first Dutch, then Swedish innovations had made the tercio more vulnerable, having less flexibility and firepower than its more modern equivalents. Nevertheless, Spanish armies continued to win major battles and sieges throughout this period across large swathes of Europe. French entry into the war in 1635 put additional pressure on Spain, with the French victory at the Battle of Rocroi in 1643 being a major boost for the French, though it proved far from decisive in the long-running Franco-Spanish War (1635–1659). By the signing of the Peace of Westphalia in 1648, which brought an end to most of the fighting, Spain was clearly exhausted. Politics too had begun to count against Spain. While Spain was fighting France, Portugal – which had been under personal union with Spain for 60 years – acclaimed John IV of Braganza as king in 1640.
Spain was forced to accept the independence of the Dutch Republic in 1648, another sign of diminishing power. In the second half of the century, a much reduced and increasingly neglected Spanish army became infamous for being poorly equipped and rarely paid. For the remainder of the century, France continued to grow in relative power under Louis XIV. The Franco-Spanish War (1635–59) ended in defeat. However, despite some Spanish concessions (Roussillon and French Flanders); the Spanish maintained their main territorial holdings in the Low Countries and Italy . The War of Devolution (1667–68) proved a one sided affair, as French forces overcame badly neglected Spanish forces and fortifications, marking the military ascendancy of France. The outcome of the War of the Reunions (1683–1683) had a similar outcome. During the Nine Years' War, Spain also lost Catalonia to France but it was restored to the kingdom in 1697 with the treaty of Ryswick.
The centre of Spanish military power shifted dramatically in the early 18th century. The War of the Spanish Succession (1701–1714) was both a civil and international war in which the French backed the Bourbon contender for the Spanish throne and an alliance led by Austria, the Dutch Republic and Britain backed the Habsburg contender while a divided Spain fought on both sides. The war secured the Spanish throne for the Bourbon Philip as Philip V of Spain at the Peace of Utrecht but in the war's settlement, Spain had to give up the Spanish Netherlands, Naples, Milan, Sardinia, Sicily, Gibraltar and Menorca to the Habsburg allies. Spain's defeat by the combined alliance of France, Britain, the Netherlands and Austria in the War of the Quadruple Alliance (1718–1720) confirmed the decline from her former dominance, whilst the successful deployment of the Britain's Royal Navy into the Mediterranean, by exploiting the fortress of Gibraltar, gained in 1704 by an Anglo-Dutch force during the war of succession, would create considerable difficulties in the following years.
Globally, Spain remained an important naval and military power, depending on critical sea lanes stretching from Spain through the Caribbean and South America, and westwards towards Manila and the Far East. The 18th century saw an ongoing struggle between the growing naval power of the rising imperial power Great Britain and Spain that worked to maintain it transoceanic links with its overseas empire, still by far the largest of the time. The number of Spanish galleons deploying across the Atlantic sea routes increased significantly in the first half of the century, undoing the decline of the latter 17th century. Britain engaged in numerous attempts to disrupt Spain's control over the Spanish Main during the early 18th century, culminating in the War of Jenkins' Ear and a disastrous attempt to capture the port of Cartegena in 1741. During the Seven Years' War (1756–1763), Britain leveraged its existing island bases along the Spanish Main and the Spanish West Indies, capturing Havana and Manila, but in each case practical and strategic considerations led to their return in exchange for Florida. During the American Revolutionary War, Spanish forces reconquered Florida and assisted the American rebels with arms and soldiers and by attacks on British trade and supplies. Both Spain and Britain made extensive use of privateers throughout the war, the Spanish exploiting the British aversion to using the convoy system to protect its expensive merchant assets in times of war. The earlier War of the Polish Succession was still seen as positive for Spain, as the kingdom did recover the territories lost after the war of Spanish succession, in Italy. However, during the Seven Years' War, three Spanish attempts to conquer Portugal ended in crushing disasters.
The huge distances involved in warfare between European powers in the Americas usually counted in favour of the defenders. Attacks on Spanish possessions, such as the amphibious assaults launched during the War of Jenkins' Ear usually ended in failure as their overstretched forces failed to overcome well led defensive actions. Spain's involvement in the American Revolutionary War (1779–83) was largely a success, underlining the resources that Spain still had at its disposal. Spain entered the war after the Battle of Saratoga, with the aim, as in the Seven Years' War, of recovering Gibraltar and Menorca and retaking the British colonies near New Spain. Their successful invasion of Menorca in 1781, and the capture of West Florida and East Florida from the British, showed a renewed strength in the New World, although the British defence of Gibraltar prevented the Spanish achieving all their war goals.
The Napoleonic Wars were to have a tremendous impact on Spanish military history, both within Spain itself and across her American colonies. The armies of the First French Empire deposed Ferdinand VII of Spain, and Spain's subsequent liberation struggle marked one of the first national wars and the emergence of large-scale guerrillas, from which the English language borrowed the word. The French occupation destroyed the Spanish administration, which fragmented into quarrelling provincial juntas. In 1810, the factions coalesced in the form of the Cortes of Cádiz, which served as a democratic Regency based in their last major foothold. During Napoleon's two year long Siege of Cádiz, it was difficult for the Cortes of Cádiz to recruit, train, or equip effective armies. However, Napoleon's failure to pacify the people of Spain allowed British, Portuguese and Spanish forces to secure Portugal and engage French forces on the frontiers, while Spanish guerrilleros wore down the occupiers.
As to the role played by the Spanish armies, David Gates notes, "Furthermore, irrespective of the quality of their men, the Spanish armies constituted a threat that the French quite simply could not ignore. Any sizeable concentration of enemy soldiers had to be engaged, or at least contained, by a sufficiently strong force of Imperial troops; otherwise they were free to go on the rampage with impunity. Consequently, a colossal percentage of the French army was rendered unavailable for operations against Wellington because innumerable Spanish contingents kept materialising all over the country." Acting in concert, regular and irregular allied forces prevented Napoleon's marshals from subduing the rebellious Spanish provinces. The Spanish navy, put to sea in support of France during the War of the Third Coalition in 1805, suffered terrible losses at the Battle of Trafalgar, having been weakened by yellow fever in the preceding years; in many ways this marked the nadir of Spanish naval history.
The events in mainland Spain had extensive consequences for her empire. Spain's colonies in the Americas had shown an increasing independence in the years running up to the Peninsular War; the British invasions of the River Plate in 1806 and 1807, for example, had been rebuffed by well organised local militia. The occupation of the Spanish homeland, however, resulted in first a sequence of uprisings in support of the imprisoned king, and then a struggle for independence that increasingly formed a series of civil wars across the Spanish dominions in the America. The conflict started in 1808, with juntas established in Mexico and Montevideo in reaction to the events of the Peninsular War. The conflict, lasting twenty years, was far from one sided. Patriot forces were often underequipped, largely peasant militia armies commanded by amateur officers; Royalist forces, partially supported from Spain over huge sea distances, were frequently able to gain the upper hand.
The Spanish navy was easily able to dominate the local, coastal navies of her colonies. Campaigning across the huge distances of South America, frequently in winter conditions with minimal supplies, resulted in terrible privation. Ultimately, Royalist exhaustion and growing political maturity amongst the new states resulted in the creation of a chain of newly independent countries stretching from Argentina and Chile in the south to Mexico in the north. Only Cuba and Puerto Rico remained under Spanish rule.
In the aftermath of the Napoleonic Wars, Spain's military found itself involved in an increasing number of internal conflicts, distracting military attention from other priorities, and continuing to undermine the Spanish economy. The first of these, the Trienio Liberal (1820–23) involved a revolt by soldiers against King Ferdinand VII while they were being embarked for a campaign in America. France intervened militarily to support the monarchy, restoring order, but this was short-lived. In 1830 the Spanish Army had a size of 250,000 active soldiers, and 50,000 reserves, but it was still a divided nation with internal conflicts. When Ferdinand died in 1833, his fourth wife Maria Cristina became Queen regent on behalf of their infant daughter Isabella II. This splintered the country into two factions known as the Cristinos – the supporters of the Queen regent – and the Carlists, the supporters of Carlos V, who had rejected the Pragmatic Sanction of 1830 that abolished the Salic law. The First Carlist War lasted over seven years and the fighting spanned most of the country at one time or another, although the main conflict centered on the Carlist homelands of the Basque Country and Aragon. Many of the military officers involved had served in the Peninsular War a few years before. The Second Carlist War was a minor Catalan uprising in support of Carlos VI, lasting from 1846 to 1849. The Third Carlist War began after Queen Isabella II was overthrown by a conspiracy of liberal generals in 1868, and left Spain in some disgrace; four years later, the latest Carlist pretender, Carlos VII, decided that only force of arms could win him the throne. This Third Carlist War lasted until 1876.
Under Isabella II of Spain, there were several, ultimately unsuccessful, attempts to reassert Spanish military influence around the world, often in partnership with France. In 1848 Spain intervened to support Pope Pius IX against local republican opposition. In February 1849, five warships, including the frigates steamed to Gaeta from Barcelona, three more from Cádiz following in May. In total, 4,000 Spanish soldiers were deployed in Gaeta and placed at the Pope's disposition. This marked the Spanish Army's first expeditionary venture into Italy since the War of the Austrian Succession a hundred years prior. In partnership with the French, Spanish columns secured the region. In 1858 Spain joined with France to intervene in Cochin China, donating 300 Filipino troops to the invasion. Spain joined an allied expedition in support of the Second French intervention in Mexico. In 1859, Spain fought a short war with Morocco, resulting in a stronger Spanish position in North Africa. By the 1860s, Spain had built up a very large navy again, and in 1864 Spain intervened along the South American cost, seizing the guano-rich Chincha Islands from its former colony of Peru. Although the new Spanish steam frigates were superior to local vessels, the huge distances and lack of land support ultimately concluded with Spain handing back the islands at the end of the Chincha Islands War. An attempt to recolonise Santo Domingo similarly failed by 1865 in the face of fierce guerrilla resistance.
Spain faced a sequence of challenges across her colonies in the second half of the century that would result in a total defeat of empire at the hands of the growing power of the United States. Spain's colony of Cuba rebelled in 1868, leading to a sequence of brutal guerrilla insurgencies and retaliations, through the Ten Years' War (1868–1878), the Little War (1879–1880) and finally the Cuban War of Independence (1895–1898). Spain, although militarily occupied with the Carlist troubles at home, put increasing resources into the conflict, slowly taking the upper hand, and assisted by American sales of modern weaponry. By 1898, however, increasing U.S. political interests in Cuba were encouraging a more interventionist policy. The sinking of the USS Maine in Havana harbour provided the trigger for the Spanish–American War, in which Spain's aging navy fared disastrously. Cuba gained its independence and Spain lost its remaining New World colony, Puerto Rico, which together with Guam and the Philippines it ceded to the United States for 20 million dollars. In 1899, Spain sold its remaining Pacific islands – the Northern Mariana Islands, Caroline Islands and Palau – to Germany, reducing Spain's colonial possessions to Spanish Morocco, the Spanish Sahara and Spanish Guinea, all in Africa.
Although Spain remained neutral during World War I, despite suffering considerable economic losses to German submarines, she was militarily active elsewhere during the early part of the 20th century, attempting to strengthen her position in North Africa. Despite successes in the late 19th century, the first Rif War (1893–94) around Melilla had also shown the potential weakness of the Spanish position along the coast. The second Rif War (1909–10) was initially a fiasco for the under-equipped and undertrained Spanish, until heavy artillery was brought in; in the aftermath of the war, Spain began to raise units of local Regulares. The third Rif War (1920–1926) also began badly for the Spanish, especially after the disaster of Annual (1921), resulting in various changes to the Spanish approach. Working in alliance with French forces in the region, Spain created the Spanish Legion along similar lines to the French Foreign Legion to provide additional experienced forces. Spain also became the first country to deploy chemical weapons by air, dropping mustard gas from aircraft.
In 1931, following the proclamation of the Second Spanish Republic, the armed forces of the Spanish Kingdom became the Spanish Republican Armed Forces. The Spanish Civil War (1936–39) began right after the Spanish coup of July 1936, a partially successful coup d'état by a section of the Spanish Army against the government of the Spanish Republic. The ensuing Civil War devastated Spain, ending with the victory of the rebels and the founding of the Spanish State, led by caudillo Francisco Franco, the leader of the Nationalist army.
The civil war was marked by the extensive involvement of international units. Many joined the Republican side under the banner of the International Brigades. The Nationalists enjoyed support from Nazi Germany and Fascist Italy, with several new technologies being trialled as a result. The Nationalist side conducted aerial bombing of cities in Republican territory, carried out mainly by the Luftwaffe volunteers of the Condor Legion and the Italian air force volunteers of the Corpo Truppe Volontarie – the most notorious example of this tactic of terror bombings was the bombing of Guernica. The first combat use of the Stuka occurred during the conflict. The civil war influenced European military thinking on the alleged supremacy of the bomber. Armoured warfare was also trialled by Nationalist supporters; German volunteers first used armor in live field conditions in the form of the Panzer Battalion 88, a force built around three companies of PzKpfw I tanks that functioned as a training cadre for Nationalists.
Weakened and politically still fragile, Spain remained officially neutral during World War II. However, to repay Hitler for his assistance in the Civil War, Franco raised a volunteer corps, the Blue Division (with an aerial counterpart, the Blue Squadron), to fight on the Eastern Front. In that way, by only fighting the Soviet Union, Franco could repay Hitler while staying at peace with the Western Allies. Nearly fifty thousand Spanish personnel served from June 1941 til October 1943, seeing fierce action in the Siege of Leningrad and the Battle of Krasny Bor. After Franco was pressured by Allied leaders to withdraw the Division, a token force of volunteers remained as the Blue Legion. Fighting for the Allies, many exiled Spanish Republicans, called Spanish Maquis, joined the French Resistance. Thousands also served in the Free French Forces; particularly of note is the Ninth Armoured Company under General Leclerc's Second Division. The first Allied unit to enter Paris in 1944, it was almost entirely made up of Spanish exiles.
In the post-war period, Spain was initially still heavily influenced by events in North Africa, particularly surrounding its colony of Western Sahara The first of these conflicts, the Ifni War (1956–1958) saw Spanish forces, including Spain's first paratroop unit, clash with the Moroccan Liberation Army, a Moroccan state backed insurgency movement. In 1958, a joint French-Spanish offensive, using massively superior European air power, crushed the revolt. In the 1970s, the rise of another insurgency movement, Polisario, resulted in the Western Sahara War (1973–1991), with Spain withdrawing from its colony in 1975 and transferring its support in the continuing conflict to Morocco.
From the 1950s onwards, however, Spain began to build increasingly close links with the U.S. armed forces. The Spanish Air Force received its first American jets, such as the F-86 Sabre and Lockheed T-33, from America, whilst the equipment of the Spanish military was again modernised in the 1970s to prepare for Spain's membership of NATO in 1982. Spain sent a small medical unit to the Vietnam War, and a team of engineers to the Gulf War with Spain lending airpower to the NATO efforts during the Bosnian War, the Kosovo War and Libyan Civil War. Most recently, Spain has participated in both the conflicts in Afghanistan and Iraq.
Historically, in addition to Latin military terms that came down from Roman times into modern Spanish through the language, the Spanish adopted a number of Arabic military terms from their Muslim rivals. Subsequently, a number of Spanish military terms have been adopted into French, English and other languages.