# History of Spain

The history of Spain dates to contact between the pre-Roman peoples of the Mediterranean coast of the Iberian Peninsula with the Greeks and Phoenicians. During Classical Antiquity, the peninsula was the site of multiple successive colonizations of Greeks, Carthaginians, and Romans. Native peoples of the peninsula, such as the Tartessos, intermingled with the colonizers to create a uniquely Iberian culture. The Romans referred to the entire peninsula as Hispania, from which the name "Spain" originates. As was the rest of the Western Roman Empire, Spain was subject to numerous invasions of Germanic tribes during the 4th and 5th centuries AD, resulting in the end of Roman rule and the establishment of Germanic kingdoms, marking the beginning of the Middle Ages in Spain.
Germanic control lasted until the Umayyad conquest of Hispania began in 711. The region became known as Al-Andalus, and except for the small Kingdom of Asturias, the region remained under the control of Muslim-led states for much of the Early Middle Ages, a period known as the Islamic Golden Age. By the time of the High Middle Ages, Christians from the north gradually expanded their control over Iberia, a period known as the Reconquista. As they expanded southward, a number of Christian kingdoms were formed, including the Kingdom of Navarre, the Kingdom of León, the Kingdom of Castile, and the Kingdom of Aragon. They eventually consolidated into two roughly equivalent polities, the Crown of Castile and the Crown of Aragon. The early modern period is generally dated from the union of the Crowns of Castile and Aragon by royal marriage in 1469.
The joint rule of Isabella I and Ferdinand II is historiographically considered the foundation of a unified Spain. The conquest of Granada, and the first voyage of Columbus, both in 1492, made that year a critical inflection point in Spanish history. The voyages of the explorers and conquistadors of Spain during the subsequent decades helped establish a Spanish colonial empire which was among the largest ever. King Charles I established the Spanish Habsburg dynasty. Under his son Philip II the Spanish Golden Age flourished, the Spanish Empire reached its territorial and economic peak, and his palace at El Escorial became the center of artistic flourishing. However, Philip's rule also saw the destruction of the Spanish Armada, a number of state bankruptcies and the independence of the Northern Netherlands, which marked the beginning of the slow decline of Spanish influence in Europe. Spain's power was further tested by its participation in the Eighty Years' War, whereby it tried and failed to recapture the newly independent Dutch Republic, and the Thirty Years' War, which resulted in continued decline of Habsburg power in favor of the French Bourbon dynasty. Matters came to a head with the death of the last Habsburg ruler Charles II of Spain; the War of the Spanish Succession broke out between two European alliances led by the French Bourbons and the Austrian Habsburgs, for the control of the Spanish throne. The Bourbons prevailed, resulting in the ascension of Philip V of Spain, who took Spain into various wars and eventually recaptured the territories in southern Italy that had been lost in the War of the Spanish Succession. Spain's late entry into the Seven Years War was the result of fear of the growing successes of the British at the expense of the French, but Spanish forces suffered defeats. Motivated by this and earlier setbacks during Bourbon rule, Spanish institutions underwent a period of reforms, especially under Charles III, that culminated in Spain's largely successful involvement in the American War of Independence.
During the Napoleonic era, Spain became a French puppet state. Concurrent with, and following, the Napoleonic period the Spanish American wars of independence resulted in the loss of most of Spain's territory in the Americas. During the re-establishment of the Bourbon rule in Spain, constitutional monarchy was introduced in 1813. Spain's history during the nineteenth century was tumultuous, and featured alternating periods of republican-liberal and monarchical rule. The Spanish–American War led to losses of Spanish colonial possessions and a series of military dictatorships, during which King Alfonso XIII was deposed and a new Republican government was formed. Ultimately, the political disorder within Spain led to a coup by the military which led to the Spanish Civil War. After much foreign intervention on both sides, the Nationalists emerged victorious; Francisco Franco led a fascist dictatorship for almost four decades. Franco's death ushered in a return of the monarchy under King Juan Carlos I, which saw a liberalization of Spanish society and a re-engagement with the international community. A new liberal Constitution was established in 1978. Spain entered the European Economic Community in 1986 (transformed into the European Union in 1992), and the Eurozone in 1998. Juan Carlos abdicated in 2014, and was succeeded by his son Felipe VI.

## Prehistory

The earliest record of Homo genus representatives living in Western Europe has been found in the Spanish cave of Atapuerca; a flint tool found there dates from 1.4 million years ago, and early human fossils date to roughly 1.2 million years ago. Modern humans in the form of Cro-Magnons began arriving in the Iberian Peninsula from north of the Pyrenees some 35,000 years ago. The most conspicuous sign of prehistoric human settlements are the paintings in the northern Spanish cave of Altamira, which were done c. 15,000 BC.
Archeological evidence in places like Los Millares and El Argar suggests developed cultures existed in the eastern part of the Iberian Peninsula during the late Neolithic and the Bronze Age. Around 2500 BC, the nomadic shepherds known as the Corded ware culture conquered the peninsula using new technologies and horses while killing all local males according to DNA studies. Spanish prehistory extends to the pre-Roman Iron Age cultures that controlled most of Iberia: those of the Iberians, Celtiberians, Tartessians, Lusitanians, and Vascones and trading settlements of Phoenicians, Carthaginians, and Greeks on the Mediterranean coast.

## Early history of the Iberian Peninsula

Before the Roman conquest the major cultures along the Mediterranean coast were the Iberians, the Celts in the interior and north-west, the Lusitanians in the west, and the Tartessians in the southwest. The seafaring Phoenicians, Carthaginians, and Greeks successively established trading settlements along the eastern and southern coast. The development of writing in the peninsula took place after the arrival of early Phoenician settlers and traders (tentatively dated 9th century BC or later).
The south of the peninsula was rich in archaic Phoenician colonies, unmatched by any other region in the central-western Mediterranean. They were small and densely packed settlements. The colony of Gadir—which sustained strong links with its metropolis of Tyre—stood out from the rest of the network of colonies, also featuring a more complex sociopolitical organization. Archaic Greeks arrived on the Peninsula by the late 7th century BC. They founded Greek colonies such as Emporion (570 BC).
The Greeks are responsible for the name Iberia, apparently after the river Iber (Ebro). By the 6th century BC, much of the territory of southern Iberia passed to Carthage's overarching influence (featuring two centres of Punic influence in Gadir and Mastia); the latter grip strengthened from the 4th century BC on. The Barcids, following their landing in Gadir in 237 BC, conquered the territories that belonged to the sphere of influence of Carthage. Until 219 BC, their presence in the peninsula was underpinned by their control of places such as Carthago Nova and Akra Leuké (both founded by Punics), as well as the network of old Phoenician settlements.
The peninsula was a military theatre of the Second Punic War (218–201 BC) waged between Carthage and the Roman Republic, the two powers vying for supremacy in the western Mediterranean. Romans expelled Carthaginians from the peninsula in 206 BC.
The peoples whom the Romans met at the time of their invasion were the Iberians, inhabiting an area stretching from the northeast part of the Iberian Peninsula through the southeast. The Celts mostly inhabited the inner and north-west part of the peninsula. To the east of the Meseta Central, the Sistema Ibérico area was inhabited by the Celtiberians, reportedly rich in precious metals (obtained by Romans in the form of tributes). Celtiberians developed a refined technique of iron-forging, displayed in their quality weapons.
The Celtiberian Wars were fought between the advancing legions of the Roman Republic and the Celtiberian tribes of Hispania Citerior from 181 to 133 BC. The Roman conquest of the peninsula was completed in 19 BC.

## Roman Hispania (2nd century BC – 5th century AD)

Hispania was the name used for the Iberian Peninsula under Roman rule from the 2nd century BC. The population was gradually culturally Romanized, and local leaders were admitted into the Roman aristocratic class.
The Romans improved existing cities, such as Tarragona, and established others like Zaragoza, Mérida, Valencia, León, Badajoz, and Palencia. The peninsula's economy expanded under Rome. Hispania supplied Rome with food, olive oil, wine and metal. The emperors Trajan, Hadrian, and Theodosius I, the philosopher Seneca, and the poets Martial, Quintilian, and Lucan were born in Hispania. Hispanic bishops held the Council of Elvira around 306.
After the fall of the Western Roman Empire in the 5th century, parts of Hispania came under the control of the Germanic tribes of Vandals, Suebi, and Visigoths.
The collapse of the Western Roman Empire did not lead to the same wholesale destruction of classical society as happened in areas like Roman Britain, Gaul and Germania Inferior during the Early Middle Ages, although the institutions and infrastructure did decline. Spain's languages, its religion, and the basis of its laws originate from this period.

## Gothic Hispania (5th–8th centuries)

The first Germanic tribes to invade Hispania arrived in the 5th century, as the Roman Empire decayed. The Visigoths, Suebi, Vandals and Alans arrived in Hispania by crossing the Pyrenees mountain range, leading to the establishment of the Suebi Kingdom in Gallaecia, in the northwest, the Vandal Kingdom of Vandalusia (Andalusia), and the Visigothic Kingdom in Toledo. The Romanized Visigoths entered Hispania in 415. After the conversion of their monarchy to Roman Catholicism and after conquering the disordered Suebic territories in the northwest and Byzantine territories in the southeast, the Visigothic Kingdom eventually encompassed a great part of the peninsula.
As Rome declined, Germanic tribes invaded the former empire. Some were foederati, tribes enlisted to serve in Roman armies and given land as payment, while others, such as the Vandals, took advantage of the empire's weakening defenses to plunder. Those tribes that survived took over existing Roman institutions, and created successor-kingdoms to the Romans in various parts of Europe. Hispania was taken over by the Visigoths after 410.
At the same time, there was a process of "Romanization" of the Germanic and Hunnic tribes. The Visigoths, for example, were converted to Arian Christianity around 360, even before they were pushed into imperial territory by the expansion of the Huns.
The Visigoths, having sacked Rome two years earlier, arrived in Gaul in 412, founding the Visigothic kingdom of Toulouse (in the south of modern France) and gradually expanded their influence into Hispania after the battle of Vouillé (507) at the expense of the Vandals and Alans, who moved on into North Africa without leaving much permanent mark on Hispanic culture. The Visigothic Kingdom shifted its capital to Toledo and reached a high point during the reign of Leovigild.

### Visigothic rule

The Visigothic Kingdom conquered all of Hispania and ruled it until the early 8th century, when the peninsula fell to the Muslim conquests. The Muslim state in Hispania came to be known as Al-Andalus. After a period of Muslim dominance, the medieval history of Spain is dominated by the long Christian Reconquista or "reconquest" of the Iberian Peninsula. The Reconquista gathered momentum during the 12th century, leading to the establishment of the Christian kingdoms of Portugal, Aragon, Castile and Navarre and by 1250, had reduced Muslim control to the Emirate of Granada in the south-east. Muslim rule in Granada survived until 1492, when it fell to the Catholic Monarchs.
Hispania never saw a decline in interest in classical culture to the degree observable in Britain, Gaul, and Germany. The Visigoths, having assimilated Roman culture and language during their tenure as foederati, maintained more of the old Roman institutions. They had a unique respect for legal codes that resulted in continuous frameworks and historical records for most of the period between 415, when Visigothic rule in Hispania began, and 711 when it is traditionally said to end. The Liber Iudiciorum or Lex Visigothorum (654), also known as the Book of Judges, which Recceswinth promulgated, based on Roman law and Germanic customary laws, brought about legal unification. According to the historian Joseph O'Callaghan, at that time they already considered themselves one people and together with the Hispano-Gothic nobility they called themselves the gens Gothorum. In the early Middle Ages, the Liber Iudiciorum was known as the Visigothic Code and also as the Fuero Juzgo. Its influence on law extends to the present.
The proximity of the Visigothic kingdoms to the Mediterranean and the continuity (though reduced) of western Mediterranean trade supported Visigothic culture. The Visigothic ruling class looked to Constantinople for style and technology.
Spanish Catholicism also coalesced during this time. The period of rule by the Visigothic Kingdom saw the spread of Arianism briefly in Hispania. The Councils of Toledo debated creed and liturgy in orthodox Catholicism, and the Council of Lerida in 546 constrained the clergy and extended the power of law over them with the approval of the Pope. In 587, the Visigothic king at Toledo, Reccared, converted to Catholicism and launched a movement to unify the various religious doctrines in Hispania.
The Visigoths inherited from Late Antiquity a prefeudal system in Hispania, based in the south on the Roman villa system and in the north drawing on their vassals to supply troops in exchange for protection. The bulk of the Visigothic army was composed of slaves. The loose council of nobles that advised Hispania's Visigothic kings and legitimized their rule was responsible for raising the army, and only upon its consent was the king able to summon soldiers.
The economy of the Visigothic kingdom depended primarily on agriculture and animal husbandry; there is little evidence of Visigothic commerce and industry. The native Hispani maintained the cultural and economic life of Hispania and were responsible for the relative prosperity of the 6th and 7th centuries. Administration was still based on Roman law, and only gradually did Visigothic customs and Roman common law merge.
The Visigoths did not, until the period of Muslim rule, intermarry with the Spanish population, and the Visigothic language had a limited impact on the modern languages of Iberia. The historian Joseph F. O'Callaghan says that at the end of the Visigothic era the assimilation of Hispano-Romans and Visigoths was occurring rapidly, and the leaders of society were beginning to see themselves as one people. Little literature in the Gothic language remains from the period of Visigothic rule—only translations of parts of the Greek Bible and a few fragments of other documents have survived.
The Hispano-Romans found Visigothic rule and its early embrace of the Arian heresy more of a threat than Islam, and shed their thralldom to the Visigoths only in the 8th century, with the aid of the Muslims themselves. The most visible effect of Visigothic rule was the depopulation of the cities as their inhabitants moved to the countryside. Even while the country enjoyed a degree of prosperity when compared to France and Germany, the Visigoths felt little reason to contribute to the welfare, permanency, and infrastructure of their people and state. This contributed to their downfall, as they could not count on the loyalty of their subjects when the Moors arrived in the 8th century.

### Goldsmithery in Visigothic Hispania

In Spain, an important collection of Visigothic metalwork was found in Guadamur, known as the Treasure of Guarrazar. This archeological find comprises twenty-six votive crowns and gold crosses from the royal workshop in Toledo, with signs of Byzantine influence.
* Two important votive crowns are those of Recceswinth and of Suintila, displayed in the National Archaeological Museum of Madrid; both are made of gold, encrusted with sapphires, pearls, and other precious stones. Suintila's crown was stolen in 1921 and never recovered. There are several other small crowns and many votive crosses in the treasure.
* The aquiliform (eagle-shaped) fibulae that have been discovered in necropolises such as Duraton, Madrona or Castiltierra cities of Segovia. These fibulae were used individually or in pairs, as clasps or pins in gold, bronze and glass to join clothes.
* The Visigothic belt buckles, a symbol of rank and status characteristic of Visigothic women's clothing, are also notable as works of goldsmithery. Some pieces contain exceptional Byzantine-style lapis lazuli inlays and are generally rectangular in shape, with copper alloy, garnets and glass.

### Architecture of Visigothic Hispania

During their governance of Hispania, the Visigoths built several churches in the basilical or cruciform style that survive, including the churches of San Pedro de la Nave in El Campillo, Santa María de Melque in San Martín de Montalbán, Santa Lucía del Trampal in Alcuéscar, Santa Comba in Bande, and Santa María de Lara in Quintanilla de las Viñas. The Visigothic crypt (the Crypt of San Antolín) in the Palencia Cathedral is a Visigothic chapel from the mid 7th century, built during the reign of Wamba to preserve the remains of the martyr Saint Antoninus of Pamiers. These are the only remains of the Visigothic cathedral of Palencia.
Reccopolis, located near the tiny modern village of Zorita de los Canes, is an archaeological site of one of at least four cities founded in Hispania by the Visigoths. It is the only city in Western Europe to have been founded between the fifth and eighth centuries. The city's construction was ordered by the Visigothic king Liuvigild to honor his son Reccared and to serve as Reccared's seat as co-king in the Visigothic province of Celtiberia.

### Religion

At the beginning of the Visigothic Kingdom, Arianism was the official religion in Hispania, but only for a brief time, according to historian Rhea Marsh Smith. In 587, Reccared, the Visigothic king at Toledo, converted to Catholicism and launched a movement to unify the religious doctrines that existed in the Iberian Peninsula. The Councils of Toledo debated the creed and liturgy of orthodox Catholicism, and the Council of Lerida in 546 constrained the clergy and extended the power of law over them with the approval of the pope.
While the Visigoths clung to their Arian faith, the Jews were well-tolerated. Previous Roman and Byzantine law determined their status, and already sharply discriminated against them. Historian Jane Gerber relates that some of the Jews "held ranking posts in the government or the army; others were recruited and organized for garrison service; still others continued to hold senatorial rank". In general, they were well-respected and well-treated by the Visigothic kings, until their transition from Arianism to Catholicism. Conversion to Catholicism across Visigothic society reduced the friction between the Visigoths and the Hispano-Roman population. However, the Visigothic conversion negatively impacted the Jews, who came under scrutiny for their religious practices.

## Islamic al-Andalus and the Christian Reconquest (8th–15th centuries)

The Umayyad Caliphate dominated most of North Africa by 710 AD. In 711 an Islamic Berber conquering party, led by Tariq ibn Ziyad, was sent to Hispania to intervene in a civil war in the Visigothic Kingdom. Crossing the Strait of Gibraltar, they won a decisive victory in the summer of 711 when the Visigothic King Roderic was defeated and killed on July 19 at the Battle of Guadalete. Tariq's commander, Musa, quickly crossed with Arab reinforcements, and by 718 the Muslims were in control of nearly the whole Iberian Peninsula. The advance into Western Europe was only stopped in what is now north-central France by the West Germanic Franks under Charles Martel at the Battle of Tours in 732.
The Muslim conquerors (also known as "Moors") were Arabs and Berbers; following the conquest, conversion and arabization of the Hispano-Roman population took place, (muwalladum or Muwallad). After a long process, spurred on in the 9th and 10th centuries, the majority of the population in Al-Andalus converted to Islam. The Muslim population was divided per ethnicity (Arabs, Berbers, Muwallad), and the supremacy of Arabs over the rest of group was a recurrent cause for strife, rivalry and hatred, particularly between Arabs and Berbers. Arab elites could be further divided in the Yemenites (first wave) and Syrians (second wave). Male Muslim rulers were often the offspring of female Christian slaves. Christians and Jews were allowed to live as subordinate groups of a stratified society under the dhimmah system, although Jews became very important in certain fields. Some Christians migrated to the Northern Christian kingdoms, while those who stayed in Al-Andalus progressively arabised and became known as musta'arab (mozarabs). Besides slaves of Iberian origin, the slave population also comprised the Ṣaqāliba (literally meaning "slavs", although they were slaves of generic European origin) as well as Sudanese slaves. The frequent raids in Christian lands provided Al-Andalus with continuous slave stock, including women who often became part of the harems of the Muslim elite. Slaves were also shipped from Spain to elsewhere in the Ummah.
In what should not have amounted to much more than a skirmish (later magnified by Spanish nationalism), a Muslim force sent to put down the Christian rebels in the northern mountains was defeated by a force reportedly led by Pelagius, known as the Battle of Covadonga. The figure of Pelagius, a by-product of the Asturian chronicles of Alfonso III (written more than a century after the alleged battle), has been later reconstructed in conflicting historiographical theories, most notably that of a refuged Visigoth noble or an autochthonous Astur chieftain. The consolidation of a Christian polity that came to be known as the Kingdom of Asturias ensued later. At the end of Visigothic rule, the assimilation of Hispano-Romans and Visigoths was occurring rapidly. An unknown number fled and took refuge in Asturias or Septimania. In Asturias they supported Pelagius's uprising, and joining with the indigenous leaders, formed a new aristocracy. The population of the mountain region consisted of native Astures, Galicians, Cantabri, Basques and other groups unassimilated into Hispano-Gothic society. In 739, a rebellion in Galicia, assisted by the Asturians, drove out Muslim forces and it joined the Asturian kingdom. In the northern Christian kingdoms, lords and religious organizations often owned Muslim slaves who were employed as laborers and household servants.
Caliph Al-Walid I had paid great attention to the expansion of an organized military, building the strongest navy in the Umayyad Caliphate era (the second major Arab dynasty after Mohammad and the first Arab dynasty of Al-Andalus). It was this tactic that supported the ultimate expansion to Hispania. Islamic power in Spain specifically climaxed in the 10th century under Abd-al-Rahman III. The rulers of Al-Andalus were granted the rank of Emir by the Umayyad Caliph Al-Walid I in Damascus. When the Abbasids overthrew the Umayyad Caliphate, Abd al-Rahman I managed to escape to al-Andalus and declared it independent. The state founded by him is known as the Emirate of Cordoba. Al-Andalus was rife with internal conflict between the Islamic Umayyad rulers and people and the Christian Visigoth-Roman leaders and people.
The Vikings invaded Galicia in 844, but were heavily defeated by Ramiro I at A Coruña. Many of the Vikings' casualties were caused by the Galicians' ballistas – powerful torsion-powered projectile weapons that looked rather like giant crossbows. 70 Viking ships were captured and burned. Vikings returned to Galicia in 859, during the reign of Ordoño I. Ordoño was at the moment engaged against his constant enemies the Moors; but a count of the province, Don Pedro, attacked the Vikings and defeated them, destroying 38 of their ships.
In the 10th century Abd-al-Rahman III declared the Caliphate of Córdoba, effectively breaking all ties with the Egyptian and Syrian caliphs. The Caliphate was mostly concerned with maintaining its power base in North Africa, but these possessions eventually dwindled to the Ceuta province. The first navy of the Emir of Córdoba was built after the Viking ascent of the Guadalquivir in 844 when they sacked Seville.
In 942, Hungarian raids on Spain, especially in Catalonia, took place, according to Ibn Hayyan's work. Meanwhile, a slow but steady migration of Christian subjects to the northern kingdoms in Christian Hispania was slowly increasing the latter's power.
Al-Andalus coincided with La Convivencia, an era of relative religious tolerance, and with the Golden age of Jewish culture in the Iberian Peninsula. Muslim interest in the peninsula returned in force around the year 1000 when Al-Mansur (Almanzor) sacked Barcelona in 985, and he assaulted Zamora, Toro, Leon and Astorga in 988 and 989, which controlled access to Galicia. Under his son, other Christian cities were subjected to numerous raids. After his son's death, the caliphate plunged into a civil war and splintered into the so-called "Taifa Kingdoms". The Taifa kings competed in war and in the protection of the arts, and culture enjoyed a brief renaissance. The aceifas (Muslim military expeditions made in summer in medieval Spain) were the continuation of a policy from the times of the emirate: the capture of numerous contingents of Christian slaves, the saqáliba (plural of siqlabi, "slave"). These were the most lucrative part of the booty, and constituted an excellent method of payment for the troops, so much so that many aceifas were hunts for people. The Almohads, who had taken control of the Almoravids' Maghribi and al-Andalus territories by 1147, surpassed the Almoravides in fundamentalist Islamic outlook, and they treated the non-believer dhimmis harshly. Faced with the choice of death, conversion, or emigration, many Jews and Christians left.
By the mid-13th century, the Emirate of Granada was the only independent Muslim realm in Spain, which survived until 1492 by becoming a vassal state to Castile, to which it paid tribute.

### Warfare between Muslims and Christians

Medieval Spain was the scene of almost constant warfare between Muslims and Christians.
The Taifa kingdoms lost ground to the Christian realms in the north. After the loss of Toledo in 1085, the Muslim rulers reluctantly invited the Almoravids, who invaded Al-Andalus from North Africa and established an empire. In the 12th century the Almoravid empire broke up again, only to be taken over by the Almohad invasion, who were defeated by an alliance of the Christian kingdoms in the decisive Battle of Las Navas de Tolosa in 1212. By 1250, nearly all of Hispania was back under Christian rule with the exception of the Muslim kingdom of Granada.

### Spanish language and universities

In the 13th century, many languages were spoken in the Christian kingdoms of Hispania. These were the Latin-based Romance languages of Castilian, Aragonese, Catalan, Galician, Aranese, Asturian, Leonese, and Portuguese, and the ancient language isolate of Basque. Throughout the century, Castilian (what is also known today as Spanish) gained a growing prominence in the Kingdom of Castile as the language of culture and communication, at the expense of Leonese and of other close dialects.
One example of this is the oldest preserved Castilian epic poem, Cantar de Mio Cid, written about the military leader El Cid. In the last years of the reign of Ferdinand III of Castile, Castilian began to be used for certain types of documents, and it was during the reign of Alfonso X that it became the official language. Henceforth all public documents were written in Castilian.
At the same time, Catalan and Galician became the standard languages in their respective territories, developing important literary traditions and being the normal languages in which public and private documents were issued: Galician from the 13th to the 16th century in Galicia and nearby regions of Asturias and Leon, and Catalan from the 12th to the 18th century in Catalonia, the Balearic Islands and Valencia, where it was known as Valencian. Both languages were later substituted in its official status by Castilian Spanish, till the 20th century.
In the 13th century many universities were founded in León and in Castile. Some, such as the Leonese Salamanca and the Castilian Palencia, were among the earliest universities in Europe.
In 1492, under the Catholic Monarchs, the first edition of the Grammar of the Castilian Language by Antonio de Nebrija was published.

## Early modern Spain
### Dynastic union of the Catholic Monarchs

In the 15th century, the most important among all of the Christian kingdoms that made up the old Hispania were the Kingdom of Castile, the Kingdom of Aragon, and the Kingdom of Portugal. The rulers of the kingdoms of Castile and Aragon were allied with dynastic families in Portugal, France, and other neighboring kingdoms.
The death of King Henry IV of Castile in 1474 set off a struggle for power called the War of the Castilian Succession (1475–1479). Contenders for the throne of Castile were Henry's one-time heir Joanna la Beltraneja, supported by Portugal and France, and Henry's half-sister Queen Isabella I of Castile, supported by the Kingdom of Aragon and by the Castilian nobility.
Isabella retained the throne and ruled jointly with her husband, King Ferdinand II. Isabella and Ferdinand had married in 1469. Their marriage united both crowns and set the stage for the creation of the Kingdom of Spain, at the dawn of the modern era. That union, however, was a union in title only, as each region retained its own political and judicial structure. Pursuant to an agreement signed by Isabella and Ferdinand on January 15, 1474, Isabella held more authority over the newly unified Spain than her husband, although their rule was shared. Together, Isabella of Castile and Ferdinand of Aragon were known as the "Catholic Monarchs" (Spanish: los Reyes Católicos), a title bestowed on them by Pope Alexander VI.

#### Conclusion of the Reconquista and expulsions of Jews and Muslims

The monarchs oversaw the final stages of the Reconquista of Iberian territory from the Moors with the conquest of Granada, conquered the Canary Islands, and expelled the Jews from Spain under the Alhambra Decree. Although until the 13th century religious minorities (Jews and Muslims) had enjoyed considerable tolerance in Castile and Aragon – the only Christian kingdoms where Jews were not restricted from any professional occupation – the situation of the Jews collapsed over the 14th century, reaching a climax in 1391 with large scale massacres in every major city except Ávila.
The Catholic Monarchs ordered the remaining Jews to convert or face expulsion from Spain in 1492, and extended the expulsion decrees to their territories on the Italian peninsula, including Sicily (1493), Naples (1542), and Milan (1597).
Over the following decades, Muslims faced the same fate; and about 60 years after the Jews, they were also compelled to convert ("Moriscos") or be expelled. In the early 17th century, the converts were also expelled.
Isabella ensured long-term political stability in Spain by arranging strategic marriages for her five children. Her firstborn, Isabella, married Afonso of Portugal, forging important ties between these two neighboring countries and hopefully ensuring future alliance, but the younger Isabella soon died before giving birth to an heir. Juana, Isabella's second daughter, married into the Habsburg dynasty when she wed Philip the Fair, the son of Maximilian I, King of Bohemia (Austria) and likely heir to the crown of the Holy Roman Emperor.
This ensured an alliance with the Habsburgs and the Holy Roman Empire, a powerful, far-reaching territory that assured Spain's future political security. Isabella's only son, Juan, married Margaret of Austria, further strengthening ties with the Habsburg dynasty. Isabella's fourth child, Maria, married Manuel I of Portugal, strengthening the link forged by her older sister's marriage. Her fifth child, Catherine, married King Henry VIII of England and was mother to Queen Mary I of England.

#### Conquest of the Canary Islands, Columbian expeditions to the New World, and African expansion

The Castilian conquest of the Canary Islands, inhabited by Guanche people, took place between 1402 (with the conquest of Lanzarote) and 1496 (with the conquest of Tenerife). Two periods can be distinguished in this process: the noble conquest, carried out by the nobility in exchange for a pact of vassalage, and the royal conquest, carried out directly by the Crown, during the reign of the Catholic Monarchs. By 1520, European military technology combined with the devastating epidemics such as bubonic plague and pneumonia brought by the Castilians and enslavement and deportation of natives led to the extinction of the Guanches. Isabella and Ferdinand authorized the 1492 expedition of Christopher Columbus, who became the first known European to reach the New World since Leif Ericson. This and subsequent expeditions led to an influx of wealth into Spain, supplementing income from within Castile for the state that was a dominant power in Europe for the next two centuries.
Spain established colonies in North Africa that ranged from the Atlantic Moroccan coast to Tripoli in Libya. Melilla was occupied in 1497, Oran in 1509, Larache in 1610, and Ceuta was annexed from the Portuguese in 1668. Today, both Ceuta and Melilla still remain under Spanish control, together with smaller islets known as the presidios menores (Peñón de Vélez de la Gomera, las Islas de Alhucemas, las Islas de Chafarinas).

### Spanish empire

The Spanish Empire was one of the first global empires. It was also one of the largest empires in world history. In the 16th century, Spain and Portugal were in the vanguard of European global exploration and colonial expansion. The two kingdoms on the conquest and Iberian Peninsula competed with each other in opening of trade routes across the oceans. Spanish imperial conquest and colonization began with the Canary Islands in 1312 and 1402. which began the Castilian conquest of the Canary Islands, completed in 1495.
In the 15th and 16th centuries, trade flourished across the Atlantic between Spain and the Americas and across the Pacific between East Asia and Mexico via the Philippines. Spanish Conquistadors, operating privately, deposed the Aztec, Inca and Maya governments with extensive help from local factions and took control of vast stretches of land. In the Philippines, the Spanish, using Mexican Conquistadors like Juan de Salcedo, conquered the kingdoms and sultanates of the islands by pitting Pagans and Muslims against each other, employing the principle of "Divide and Conquer". They considered their war against the Muslims of the Southeast Asia an extension of the Spanish Reconquista.
This New World empire was at first a disappointment, as the natives had little to trade. Diseases such as smallpox and measles that arrived with the colonizers devastated the native populations, especially in the densely populated regions of the Aztec, Maya and Inca civilizations, and this reduced their economic potential. Estimates of the pre-Columbian population of the Americas vary but possibly stood at 100 million—one fifth of humanity in 1492. Between 1500 and 1600 the population of the Americas was halved. In Mexico alone, it has been estimated that the pre-conquest population of around 25 million was reduced within 80 years to about 1.3 million.
In the 1520s, large-scale extraction of silver from the rich deposits of Mexico's Guanajuato began to be greatly augmented by the silver mines in Mexico's Zacatecas and Bolivia's Potosí from 1546. These silver shipments re-oriented the Spanish economy, leading to the importation of luxuries and grain. The resource-rich colonies of Spain thus caused large cash inflows. They also became indispensable in financing the military capability of Habsburg Spain in its long series of European and North African wars.
Spain enjoyed a cultural golden age in the 16th and 17th centuries. For a time, the Spanish Empire dominated the oceans with its experienced navy and ruled the European battlefield with its well trained infantry, the tercios.
The financial burden within the peninsula was on the backs of the peasant class while the nobility enjoyed an increasingly lavish lifestyle. From the incorporation of the Portuguese Empire in 1580 (lost in 1640) until the loss of its American colonies in the 19th century, Spain maintained one of the largest empires in the world even though it suffered military and economic misfortunes from the 1640s. The thought that Spain could bring Christianity to the New World and protect Catholicism in Europe played a strong role in the expansion of Spain's empire.

### Spanish Kingdoms under the 'Great' Habsburgs (16th century)
#### Charles I, Holy Emperor

Spain's world empire reached its greatest territorial extent in the late 18th century but it was under the Habsburg dynasty in the 16th and 17th centuries it reached the peak of its power and declined. The Iberian Union with Portugal meant that the monarch of Castile was also the monarch of Portugal, but they were ruled as separate entities both on the peninsula and in Spanish America and Brazil. In 1640, the House of Braganza revolted against Spanish rule and reasserted Portugal's independence.
When Spain's first Habsburg ruler Charles I became king of Spain in 1516 (with his mother and co-monarch Queen Juana I effectively powerless and kept imprisoned till her death in 1555), Spain became central to the dynastic struggles of Europe. Charles also became Charles V, Holy Roman Emperor and because of his widely scattered domains was not often in Spain.
In 1556 Charles abdicated, giving his Spanish empire to his only surviving son, Philip II of Spain, and the Holy Roman Empire to his brother, Ferdinand. Philip treated Castile as the foundation of his empire, but the population of Castile (about a third of France's) was never large enough to provide the soldiers needed. His marriage to Mary Tudor allied England with Spain.

#### Philip II and the wars of religion

In the 1560s, plans to consolidate control of the Netherlands led to unrest, which gradually led to the Calvinist leadership of the revolt and the Eighty Years' War. The Dutch armies waged a war of maneuver and siege, successfully avoiding pitched battle. This conflict consumed much Spanish expenditure during the later 16th century. Other extremely expensive failures included an attempt to invade Protestant England in 1588 that produced the worst military disaster in Spanish history when the Spanish Armada—costing 10 million ducats—was scattered by a storm.
Economic and administrative problems multiplied in Castile, and the weakness of the native economy became evident in the following century. Rising inflation, financially draining wars in Europe, the ongoing aftermath of the expulsion of the Jews and Moors from Spain, and Spain's growing dependency on the silver imports, combined to cause several bankruptcies that caused economic crisis in the country, especially in heavily burdened Castile. The great plague of 1596–1602 killed 600,000 to 700,000, or about 10% of the population. Altogether more than 1,250,000 deaths resulted from the extreme incidence of plague in 17th-century Spain. Economically, the plague destroyed the labor force as well as creating a psychological blow.

### Cultural Golden Age (Siglo de Oro)

The Spanish Golden Age (Siglo de Oro) was a period of flourishing arts and letters in the Spanish Empire (now Spain and the Spanish-speaking countries of Latin America), coinciding with the political decline and fall of the Habsburgs. Arts flourished despite the decline of the empire in the 17th century. The last great writer of the age, Sor Juana Inés de la Cruz, died in New Spain in 1695.
The Habsburgs were great patrons of art in their countries. El Escorial, the great royal monastery built by King Philip II, invited the attention of some of Europe's greatest architects and painters. Diego Velázquez, regarded as one of the most influential painters of European history and a greatly respected artist in his own time, cultivated a relationship with King Philip IV and his chief minister, the Count-Duke of Olivares, leaving several portraits that demonstrate his style and skill. El Greco, a respected Greek artist from the period, settled in Spain, and infused Spanish art with the styles of the Italian renaissance and helped create a uniquely Spanish style of painting.
Some of Spain's greatest music is regarded as having been written in the period. Such composers as Tomás Luis de Victoria, Luis de Milán and Alonso Lobo helped to shape Renaissance music and the styles of counterpoint and polychoral music, and their influence lasted into the Baroque period.
Spanish literature blossomed as well, most famously demonstrated in the work of Miguel de Cervantes, the author of Don Quixote. Spain's most prolific playwright, Lope de Vega, wrote possibly as many as one thousand plays over his lifetime, over four hundred of which survive.

### Decline under the 'Minor' Habsburgs (17th century)

Spain's severe financial difficulties began in the middle 16th century, and continued for the remainder of Habsburg rule. Despite the successes of Spanish armies, the period was marked by monetary inflation, mercantilism, and a variety of government monopolies and interventions. Spanish kings were forced to declare sovereign defaults nine times between 1557 and 1666.
Philip II died in 1598, and was succeeded by his son Philip III. In his reign (1598–1621) a ten-year truce with the Dutch was overshadowed in 1618 by Spain's involvement in the European-wide Thirty Years' War. Philip III was succeeded in 1621 by his son Philip IV of Spain (reigned 1621–65). Much of the policy was conducted by the Count-Duke of Olivares, the inept prime minister from 1621 to 1643. He over-exerted Spain in foreign affairs and unsuccessfully attempted domestic reform. His policy of committing Spain to recapture Holland led to a renewal of the Eighty Years' War while Spain was also embroiled in the Thirty Years' War (1618–1648). His attempts to centralise power and increase wartime taxation led to revolts in Catalonia and in Portugal, which brought about his downfall.
During the Thirty Years' War, in which various Protestant forces battled Imperial armies, France provided subsidies to Habsburg enemies, especially Sweden. Sweden lost and France's First Minister, Cardinal Richelieu, in 1635 declared war on Spain. The open war with Spain started with a victory for the French at Les Avins in 1635. The following year Spanish forces based in the Southern Netherlands hit back with devastating lightning campaigns in northern France that left the economy of the region in tatters. After 1636, however, Olivares, fearful of provoking another bankruptcy, stopped the advance. In 1640, both Portugal and Catalonia rebelled. Portugal was lost for good; in northern Italy and most of Catalonia, French forces were expelled and Catalonia's independence was suppressed. In 1643, the French defeated one of Spain's best armies at Rocroi, northern France.
The Spanish "Golden Age" politically ends no later than 1659, with the Treaty of the Pyrenees, ratified between France and Habsburg Spain.
During the long regency for Charles II, the last of the Spanish Habsburgs, favouritism milked Spain's treasury, and Spain's government operated principally as a dispenser of patronage. Plague, famine, floods, drought, and renewed war with France wasted the country. The Peace of the Pyrenees (1659) had ended fifty years of warfare with France, whose king, Louis XIV, found the temptation to exploit a weakened Spain too great. Louis instigated the War of Devolution (1667–68) to acquire the Spanish Netherlands.
By the 17th century, the Catholic Church and Spain had a close bond, attesting to the fact that Spain was virtually free of Protestantism during the 16th century. In 1620, there were 100,000 Spaniards in the clergy; by 1660 the number had grown to about 200,000, and the Church owned 20% of all the land in Spain. The Spanish bureaucracy in this period was highly centralized, and totally reliant on the king for its efficient functioning. Under Charles II, the councils became the sinecures of wealthy aristocrats despite attempts at reform. Political commentators in Spain, known as arbitristas, proposed a number of measures to reverse the decline of the Spanish economy, with limited success. In rural areas, heavy taxation of peasants reduced agricultural output as peasants migrated to the cities. The influx of silver from the Americas has been cited as the cause of inflation, although only the quinto real (royal fifth) actually went to Spain. A prominent internal factor was the Spanish economy's dependence on the export of luxurious Merino wool, which had its markets in northern Europe reduced by war and growing competition from cheaper textiles.
The once proud Spanish army was falling far behind its foes. It did badly at Bergen op Zoom in 1622. The Dutch won very easily at 's-Hertogenbosch and Wesel in 1629. In 1632 the Dutch captured the strategic fortress town of Maastricht, repulsing three relief armies and dooming the Spanish to defeat.
While Spain built a rich American Empire that exported a silver treasure fleet every year, it was unable to focus its financial, military, and diplomatic power on building up its Spanish base. The Crown's dedication to destroying Protestantism through almost constant warfare created a cultural ethos among Spanish leaders that undermined the opportunity for economic modernization or industrialization. When Philip II died in 1598, his treasury spent most of its income on funding the huge deficit, which continued to grow. In peninsular Spain, the productive forces were undermined by steady inflation, heavy taxation, immigration of ambitious youth to the colonies, and by depopulation. Industry went into reverse – Seville in 1621 operated 400 looms, where it had 16,000 a century before. Religiosity led by saints and mystics, missionaries and crusaders, theologians and friars dominated Spanish culture, with the psychology of a reward in the next world. Palmer and Colton argue:
    the generations of crusading against infidels, even, heathens and heretics had produced an exceptionally large number of minor aristocrats, chevaliers, dons, and hidalgos, who as a class were contemptuous of work and who were numerous enough and close enough to the common people to impress their haughty indifference upon the country as a whole. Elliott cites the achievements of Castille in many areas, especially high culture. He finds:
    A certain paradox in the fact that the achievement of the two most outstanding creative artists of Castile – Cervantes and Velázquez – was shot through with a deep sense of disillusionment and failure; but the paradox was itself a faithful reflection of the paradox of sixteenth-and seventeenth-century Castile. For here was a country which had climbed to the heights and sunk to the depths; which had achieved everything and lost everything; which had conquered the world only to be vanquished itself. The Spanish achievement of the sixteenth century was essentially the work of Castile, but so also was the Spanish disaster of the seventeenth; and it was Ortega y Gasset who expressed the paradox most clearly when he wrote what may serve as an epitaph on the Spain of the House of Austria: ‘Castile has made Spain, and Castile has destroyed it.’
The Habsburg dynasty became extinct in Spain with Charles II's death in 1700, and the War of the Spanish Succession ensued in which the other European powers tried to assume control of the Spanish monarchy. King Louis XIV of France eventually lost the War of the Spanish Succession. The victors were Britain, the Dutch Republic and Austria. They allowed the crown of Spain to pass to the Bourbon dynasty, provided that Spain and France never merged.
After the War of the Spanish Succession, the assimilation of the Crown of Aragon by the Castilian Crown, through the Nueva Planta Decrees, was the first step in the creation of the Spanish nation state. And like other European nation-states in formation, it was not on a uniform ethnic basis, but by imposing the political and cultural characteristics of the dominant ethnic group, in this case the Castilian, on those of the other ethnic groups, so they become national minorities to be assimilated. Nationalist policies, sometimes very aggressive, and still in force, have been and are the seeds of repeated territorial conflicts within the state.

## Spain under the Bourbons, 1715–1808

Charles II died in 1700, and having no direct heir, was succeeded by his great-nephew Philip, Duke of Anjou, a French prince. The War of the Spanish Succession (1700–1714) pitted proponents of the Bourbon succession against those for the Hapsburg. Concern among other European powers that Spain and France united under a single Bourbon monarch would upset the balance of power, the war pitted powerful France and fairly strong Spain against the Grand Alliance of England, Portugal, Savoy, the Netherlands and Austria. After an extended conflict, especially in Spain, the treaty of Utrecht recognized Philip as King of Spain (as Philip V). However, Philip was compelled to renounce any right to the French throne, despite some doubts as to the lawfulness of such an act. Spain's Italian territories were apportioned.
Philip signed the Decreto de Nueva Planta in 1715, which revoked most of the historical rights and privileges of the different kingdoms that formed the Spanish Crown, especially the Crown of Aragon, unifying them under the laws of Castile, where the Castilian Cortes Generales had been more receptive to the royal wish. Spain became culturally and politically a follower of absolutist France. Lynch says Philip V advanced the government only marginally and was more of a liability than the incapacitated Charles II; when a conflict came up between the interests of Spain and France, he usually favored France.
Philip made reforms in government, and strengthened the central authorities relative to the provinces. Merit became more important, although most senior positions still went to the landed aristocracy. Below the elite level, inefficiency and corruption was as widespread as ever. The reforms started by Philip V culminated in much more important reforms of Charles III. The historian Jonathan Israel, however, argues that King Charles III cared little for the Enlightenment and his ministers paid little attention to the Enlightenment ideas influential elsewhere on the Continent: "Most were first and foremost absolutists and their objective was always to reinforce monarchy, empire, aristocracy...and ecclesiastical control and authority over education."
The economy improved over the depressed 1650–1700 era, with greater productivity and fewer famines and epidemics.
Elisabeth of Parma, Philip V's wife, exerted great influence on Spain's foreign policy. Her principal aim was to have Spain's lost territories in Italy restored. In 1717, Philip V ordered an invasion of Sardinia. Spanish troops then invaded Sicily. The aggression prompted the Holy Roman Empire to form a new pact with the members of the Triple Alliance, resulting in the Quadruple Alliance of 1718. All members demanded Spanish retreat, resulting in war by December 1718. The war lasted two years and resulted in a rout of the Spanish. Hostilities ceased with the Treaty of The Hague in February 1720; Philip V abandoned all claims on Italy. Later, however, Spain reconquered Naples and Sicily during the War of the Polish Succession (1733–35). In 1748, after the War of the Austrian Succession (1740–48), Spain obtained the duchies of Parma, Piacenza and Guastalla in northern Italy.
The rule of the Spanish Bourbons continued under Ferdinand VI (1746–59) and Charles III (1759–88). Under the rule of Charles III and his ministers – Leopoldo de Gregorio, Marquis of Esquilache and José Moñino, Count of Floridablanca – the economy improved. Fearing that Britain's victory over France in the Seven Years' War (1756–63) threatened the European balance of power, Spain allied itself to France and invaded Portugal, a British ally, but suffered a series of military defeats and ended up having to cede Florida to the British at the Treaty of Paris (1763) while gaining Louisiana from France. Spain regained Florida with the Treaty of Paris (1783), which ended the American Revolutionary War (1775–83), and gained an improved international standing.
However, there were no reforming impulses in the reign of Charles IV (1788 to abdication in 1808), seen by some as mentally handicapped. Dominated by his wife's lover, Manuel de Godoy, Charles IV embarked on policies that overturned much of Charles III's reforms. After briefly opposing Revolutionary France early in the French Revolutionary Wars, Spain was cajoled into an uneasy alliance with France, only to be blockaded by the British. Charles IV's vacillation, culminating in his failure to honour the alliance by neglecting to enforce the Continental System, led to the invasion of Spain in 1808 under Napoleon I, thereby triggering the Peninsular War, with enormous human and property losses, and loss of control over most of the overseas empire.
During most of the 18th century Spain had arrested its relative decline of the latter part of the 17th century. But despite the progress, it continued to lag in the political and mercantile developments then transforming other parts of Europe, most notably in Great Britain, the Low Countries, and France. The chaos unleashed by the Peninsular War caused this gap to widen greatly and slowed Spain's industrialisation.
The Age of Enlightenment reached Spain in attenuated form about 1750. Attention focused on medicine and physics, with some philosophy. French and Italian visitors were influential but there was little challenge to Catholicism or the Church such as characterized the French philosophes. The leading Spanish figure was Benito Feijóo, a Benedictine monk and professor. He was a successful popularizer noted for encouraging scientific and empirical thought. By the 1770s the conservatives had launched a counterattack and used censorship and the Inquisition to suppress Enlightenment ideas.
At the top of the social structure of Spain in the 1780s stood the nobility and the church. A few hundred families dominated the aristocracy, with another 500,000 holding noble status. There were 200,000 church men and women, half of them in heavily endowed monasteries that controlled much of the land not owned by the nobles. Most people were on farms, either as landless peons or as holders of small properties. The small urban middle class was growing, but was distrusted by the landowners and peasants alike.

## War of Spanish Independence and American wars of independence
### War of Spanish Independence (1808–1814)

In the late 18th century, Spain had an alliance with France, and therefore did not have to fear a land war. Its only serious enemy was Britain, which had a powerful navy; Spain therefore concentrated its resources on its navy. When the French Revolution overthrew the Bourbons, a land war with France became a threat which the king tried to avoid. The Spanish army was ill-prepared. The officer corps was selected primarily on the basis of royal patronage, rather than merit. About a third of the junior officers had been promoted from the ranks and had few opportunities for promotion or leadership. The rank-and-file were poorly trained peasants. Elite units included foreign regiments of Irishmen, Italians, Swiss, and Walloons, in addition to elite artillery and engineering units. Equipment was old-fashioned and in disrepair. The army lacked its own horses, oxen and mules for transportation, so these auxiliaries were operated by civilians, who might run if conditions looked bad. In combat, small units fought well, but their old-fashioned tactics were hardly of use against the Napoleonic forces, despite repeated desperate efforts at last-minute reform. When war broke out with France in 1808, the army was deeply unpopular. Leading generals were assassinated, and the army proved incompetent to handle command-and-control. Junior officers from peasant families deserted and went over to the insurgents; many units disintegrated. Spain was unable to mobilize its artillery or cavalry. In the war, there was one victory at the Battle of Bailén, and many humiliating defeats. Conditions steadily worsened, as the insurgents increasingly took control of Spain's battle against Napoleon. Napoleon ridiculed the army as "the worst in Europe"; the British who had to work with it agreed. It was not the Army that defeated Napoleon, but the insurgent peasants whom Napoleon ridiculed as packs of "bandits led by monks". By 1812, the army controlled only scattered enclaves, and could only harass the French with occasional raids. The morale of the army had reached a nadir, and reformers stripped the aristocratic officers of most of their legal privileges.
Spain initially sided against France in the Napoleonic Wars, but the defeat of her army early in the war led to Charles IV's pragmatic decision to align with the French. Spain was put under a British blockade, and her colonies began to trade independently with Britain, but Britain invaded and was defeated in the British invasions of the Río de la Plata in South America (1806 and 1807) without help from mainland Spain, which emboldened independence and revolutionary hopes in Spain's American colonies. A major Franco-Spanish fleet was lost at the Battle of Trafalgar in 1805, prompting the king to reconsider his difficult alliance with Napoleon. Spain temporarily broke off from the Continental System, and Napoleon invaded Spain in 1808 and deposed Ferdinand VII, who had been on the throne only forty-eight days after his father's abdication in March 1808. On July 20, 1808, Joseph Bonaparte, eldest brother of Napoleon Bonaparte, entered Madrid and became King of Spain, serving as a surrogate for Napoleon.
Spaniards revolted. Thompson says the Spanish revolt was, "a reaction against new institutions and ideas, a movement for loyalty to the old order: to the hereditary crown of the Most Catholic kings, which Napoleon, an excommunicated enemy of the Pope, had put on the head of a Frenchman; to the Catholic Church persecuted by republicans who had desecrated churches, murdered priests, and enforced a "loi des cultes"; and to local and provincial rights and privileges threatened by an efficiently centralized government. Juntas were formed all across Spain that pronounced themselves in favor of Ferdinand VII. On September 26, 1808, a Central Junta was formed in the town of Aranjuez to coordinate the nationwide struggle against the French. Initially, the Central Junta declared support for Ferdinand VII, and convened a "General and Extraordinary Cortes" for all the kingdoms of the Spanish Monarchy. On February 22 and 23, 1809, a popular insurrection against the French occupation broke out all over Spain. The peninsular campaign was a disaster for France. Napoleon did well when he was in direct command, but that followed severe losses, and when he left in 1809 conditions grew worse for France. Vicious reprisals, famously portrayed by Goya in "The Disasters of War", only made the Spanish guerrillas angrier and more active; the war in Spain proved to be a major, long-term drain on French money, manpower and prestige.
In March 1812, the Cortes of Cádiz created the first modern Spanish constitution, the Constitution of 1812 (informally named La Pepa). This constitution provided for a separation of the powers of the executive and the legislative branches of government. The Cortes was to be elected by universal suffrage, albeit by an indirect method. Each member of the Cortes was to represent 70,000 people. Members of the Cortes were to meet in annual sessions. The King was prevented from either convening or proroguing the Cortes. Members of the Cortes were to serve single two-year terms. They could not serve consecutive terms; a member could serve a second term only by allowing someone else to serve a single intervening term in office. This attempt at the development of a modern constitutional government lasted from 1808 until 1814. Leaders of the liberals or reformist forces during this revolution were José Moñino, Count of Floridablanca, Gaspar Melchor de Jovellanos and Pedro Rodríguez, Conde de Campomanes. Born in 1728, Floridablanca was eighty years of age at the time of the revolutionary outbreak in 1808. He had served as Prime Minister under King Charles III from 1777 until 1792; However, he tended to be suspicious of the popular spontaneity and resisted a revolution. Born in 1744, Jovellanos was somewhat younger than Floridablanco. A writer and follower of the philosophers of the Enlightenment tradition of the previous century, Jovellanos had served as Minister of Justice from 1797 to 1798 and now commanded a substantial and influential group within the Central Junta. However, Jovellanos had been imprisoned by Manuel de Godoy, Duke of Alcudia, who had served as the prime minister, virtually running the country as a dictator from 1792 until 1798 and from 1801 until 1808. Accordingly, even Jovellanos tended to be somewhat overly cautious in his approach to the revolutionary upsurge that was sweeping Spain in 1808.
The Spanish army was stretched as it fought Napoleon's forces because of a lack of supplies and too many untrained recruits, but at Bailén in June 1808, the Spanish army inflicted the first major defeat suffered by a Napoleonic army; this resulted in the collapse of French power in Spain. Napoleon took personal charge and with fresh forces, defeating the Spanish and British armies in campaigns of attrition. After this the Spanish armies lost every battle they fought against the French, but were never annihilated; after battles they retreated into the mountains to regroup and launch new attacks and raids. Guerrilla forces sprang up all over Spain and, with the army, tied down huge numbers of Napoleon's troops, making it difficult to sustain concentrated attacks on Spanish forces. The raids became a massive drain on Napoleon's military and economic resources. Spain was aided by the British and Portuguese, led by the Duke of Wellington. The Duke of Wellington fought Napoleon's forces in the Peninsular War, with Joseph Bonaparte playing a minor role as king at Madrid. The brutal war was one of the first guerrilla wars in modern Western history. French supply lines stretching across Spain were mauled repeatedly by the Spanish armies and guerrilla forces; thereafter, Napoleon's armies were never able to control much of the country and ending in French defeat. The war fluctuated, with Wellington spending several years behind his fortresses in Portugal while launching occasional campaigns into Spain.
After Napoleon's disastrous 1812 campaign in Russia, Napoleon began to recall his forces for the defence of France against the advancing Russian and other coalition forces, leaving his forces in Spain increasingly undermanned and on the defensive against the advancing Spanish, British and Portuguese armies. At the Battle of Vitoria in 1813, an allied army under the Duke of Wellington decisively defeated the French and in 1814 Ferdinand VII was restored as King of Spain.

### Independence of Spanish America

Spain lost all of its North and South American territories, except Cuba and Puerto Rico, in a complex series of revolts 1808–26. Spain was at war with Britain 1798–1808, and the British blockade cut Spain's ties to the overseas empire. Trade was handled by American and Dutch traders. The colonies thus had achieved economic independence from Spain, and set up temporary governments or juntas which were generally out of touch with Spain. After 1814, as Napoleon was defeated and Ferdinand VII was back on the throne, the king sent armies to regain control and reimpose autocratic rule. In the next phase 1809–16, Spain defeated all the uprising. A second round 1816–25 was successful and drove the Spanish out of all of its mainland holdings. Spain had no help from European powers. Indeed, Britain (and the United States) worked against it. When they were cut off from Spain, the colonies saw a struggle for power between Spaniards who were born in Spain (called "peninsulares") and those of Spanish descent born in New Spain (called "creoles"). The creoles were the activists for independence. Multiple revolutions enabled the colonies to break free of the mother country. In 1824 the armies of generals José de San Martín of Argentina and Simón Bolívar of Venezuela defeated the last Spanish forces; the final defeat came at the Battle of Ayacucho in southern Peru. After that Spain played a minor role in international affairs. Business and trade in the ex-colonies were under British control. Spain kept only Cuba and Puerto Rico in the New World.

## Reign of Ferdinand VII (1813–1833)
### Aftermath of the Napoleonic wars

The Napoleonic wars had severe negative effects on Spain's long-term economic development. The Peninsular war ravaged towns and countryside alike, and the demographic impact was the worst of any Spanish war, with a sharp decline in population in many areas caused by casualties, outmigration, and disruption of family life. The marauding armies seized farmers' crops, and more importantly, farmers lost much of their livestock, their main capital asset. Severe poverty became widespread, reducing market demand, while the disruption of local and international trade, and the shortages of critical inputs, seriously hurt industry and services. The loss of a vast colonial empire reduced Spain's overall wealth, and by 1820 it had become one of Europe's poorest and least-developed societies; three-fourths of the people were illiterate. There was little industry beyond the production of textiles in Catalonia. Natural resources, such as coal and iron, were available for exploitation, but the transportation system was rudimentary, with few canals or navigable rivers, and road travel was slow and expensive. British railroad builders were pessimistic and did not invest. Eventually a small railway system was built, radiating from Madrid and bypassing the natural resources. The government relied on high tariffs, especially on grain, which further slowed economic development. For example, eastern Spain was unable to import inexpensive Italian wheat, and had to rely on expensive homegrown products carted in over poor roads. The export market collapsed apart from some agricultural products. Catalonia had some industry, but Castile remained the political and cultural center, and was not interested in promoting industry.
Although the juntas, that had forced the French to leave Spain, had sworn by the liberal Constitution of 1812, Ferdinand VII had the support of conservatives and he rejected it. He ruled in the authoritarian fashion of his forebears.
The government, nearly bankrupt, was unable to pay its soldiers. There were few settlers or soldiers in Florida, so it was sold to the United States for $5 million. In 1820, an expedition intended for the colonies revolted in Cadiz. When armies throughout Spain pronounced themselves in sympathy with the revolters, led by Rafael del Riego, Ferdinand was forced to accept the liberal Constitution of 1812. This was the start of the second bourgeois revolution in Spain, the trienio liberal which lasted from 1820 to 1823. Ferdinand was placed under effective house arrest for the duration of the liberal experiment.

### Trienio liberal (1820–23)

The tumultuous three years of liberal rule that followed (1820–23) were marked by various absolutist conspiracies. The liberal government was viewed with hostility by the Congress of Verona in 1822, and France was authorized to intervene. France crushed the liberal government with massive force in the so-called "Hundred Thousand Sons of Saint Louis" expedition, and Ferdinand was restored as absolute monarch in 1823. In Spain proper, this marked the end of the second Spanish bourgeois revolution.

### "Ominous Decade" (1823–1833)

In Spain, the failure of the second bourgeois revolution was followed by uneasy peace for the next decade. Having borne only a female heir presumptive, it appeared that Ferdinand would be succeeded by his brother, Infante Carlos. While Ferdinand aligned with the conservatives, fearing another national insurrection, he did not view Carlos's reactionary policies as a viable option. Ferdinand – resisting the wishes of his brother – decreed the Pragmatic Sanction of 1830, enabling his daughter Isabella to become Queen. Carlos, who made known his intent to resist the sanction, fled to Portugal.

## Reign of Isabella II (1833–1868)

Ferdinand's death in 1833 and the accession of Isabella II sparked the First Carlist War (1833–39). Isabella was only three years old at the time so her mother, Maria Cristina of Bourbon-Two Sicilies governed as regent. Carlos invaded the Basque country in the north of Spain and attracted support from absolutist reactionaries and conservatives, known as the "Carlist" forces. The supporters of reform and of limitations on the absolutist rule of the Spanish throne rallied behind Isabella and the regent, Maria Cristina; these reformists were called "Christinos." Though Christino resistance to the insurrection seemed to have been overcome by the end of 1833, Maria Cristina's forces suddenly drove the Carlist armies from most of the Basque country. Carlos then appointed the Basque general Tomás de Zumalacárregui as his commander-in-chief. Zumalacárregui resuscitated the Carlist cause, and by 1835 had driven the Christino armies to the Ebro River and transformed the Carlist army from a demoralized band into a professional army of 30,000 of superior quality to the government forces. Zumalacárregui's death in 1835 changed the Carlists' fortunes. The Christinos found a capable general in Baldomero Espartero. His victory at the Battle of Luchana (1836) turned the tide of the war, and in 1839, the Convention of Vergara put an end to the first Carlist insurrection.
The progressive General Espartero, exploiting his popularity as a war hero and his sobriquet "Pacifier of Spain", demanded liberal reforms from Maria Cristina. The Queen Regent preferred to resign and let Espartero become regent instead in 1840. Espartero's liberal reforms were then opposed by moderates, and the former general's heavy-handedness caused a series of sporadic uprisings throughout the country from various quarters, all of which were bloodily suppressed. He was overthrown as regent in 1843 by Ramón María Narváez, a moderate, who was in turn perceived as too reactionary. Another Carlist uprising, the Matiners' War, was launched in 1846 in Catalonia, but it was poorly organized and suppressed by 1849.
Isabella II took a more active role in government after coming of age, but she was unpopular throughout her reign (1833–68). There was another pronunciamiento in 1854 led General Leopoldo O'Donnell, intending to topple the discredited rule of the Count of San Luis. A popular insurrection followed the coup and the Progressive Party obtained widespread support in Spain and came to government in 1854. After 1856, O'Donnell, who had already marched on Madrid that year and ousted another Espartero ministry, attempted to form the Liberal Union, his own political project. Following attacks on Ceuta by tribesmen based in Morocco, a war against the latter country was successfully waged by generals O'Donnell and Juan Prim. The later part of Isabella's reign saw also the Spanish retake of Santo Domingo (1861–1865), and the fruitless Chincha Islands War (1864–1866) against Peru and Chile.

## Sexenio Democrático (1868–1874)

In 1868 another insurgency, known as the Glorious Revolution, took place. The progresista generals Francisco Serrano and Juan Prim revolted against Isabella and defeated her moderado generals at the Battle of Alcolea (1868). Isabella was driven into exile in Paris.
Two years later, in 1870, the Cortes declared that Spain would again have a king. Amadeus of Savoy, the second son of King Victor Emmanuel II of Italy, was selected and duly crowned King of Spain early the following year. Amadeus – a liberal who swore by the liberal constitution the Cortes promulgated – was faced immediately with the incredible task of bringing the disparate political ideologies of Spain to one table. The country was plagued by internecine strife, not merely between Spaniards but within Spanish parties. Following the Hidalgo affair and an army rebellion, Amadeus famously declared the people of Spain to be ungovernable, abdicated the throne, and left the country.

### First Spanish Republic (1873–1874)

In the absence of the Monarch, a government of radicals and Republicans was formed and declared Spain a republic. The First Spanish Republic (1873–74) was immediately under siege from all quarters. The Carlists were the most immediate threat, launching a violent insurrection after their poor showing in the 1872 elections. There were calls for socialist revolution from the International Workingmen's Association, revolts and unrest in the autonomous regions of Navarre and Catalonia, and pressure from the Catholic Church against the fledgling republic.
A coup took place in January 1874, when General Pavía broke into the Cortes. This prevented the formation of a federal republican government, forced the dissolution of the Parliament and led to the instauration of a unitary praetorian republic ruled by General Serrano, paving the way for the Restoration of the Monarchy through another pronunciamiento, this time by Arsenio Martínez Campos, in December 1874.

## Restoration (1874–1931)
### Reign of Alfonso XII and Regency of Maria Christina

Following the success of a December 1874 military coup the monarchy was restored in the person of Alfonso XII (the son of former queen Isabella II). The ongoing Carlist insurrection was eventually put down. The Restoration period, following the proclamation of the 1876 Constitution, witnessed the installment of an uncompetitive parliamentary system devised by Antonio Cánovas del Castillo, in which two "dynastic" parties, the conservatives and the liberals alternated in control of the government (turnismo). Election fraud (materialized in the so-called caciquismo) became ubiquitous, with elections reproducing pre-arranged outcomes struck in the Capital. Voter apathy was no less important. The reign of Alfonso was followed by that of his son Alfonso XIII, initially a regency until the latter's coming of age in 1902.
The 1876 Constitution granted the Catholic Church control of education (particularly secondary education). Meanwhile, an organization formed in 1876 upon a group of Krausists educators, the Institución Libre de Enseñanza, had a leading role in the educational and cultural renovation in the country, covering for the inaction of the Spanish State.

### Disaster of 1898

In 1868, Cuba launched a war of independence against Spain. As had been the case in Santo Domingo, the Spanish government was embroiled in a difficult campaign against an indigenous rebellion. Unlike in Santo Domingo, however, Spain initially won this struggle. The pacification of the island was temporary, however, as the conflict revived in 1895 and ended in defeat at the hands of the United States in the Spanish–American War of 1898. Cuba gained its independence and Spain lost its remaining New World colony, Puerto Rico, which together with Guam and the Philippines were ceded to the United States for $20 million. In 1899, Spain sold its remaining Pacific islands – the Northern Mariana Islands, Caroline Islands and Palau – to Germany and Spanish colonial possessions were reduced to Spanish Morocco, Spanish Sahara and Spanish Guinea, all in Africa.
The "disaster" of 1898 created the Generation of '98, a group of statesmen and intellectuals who demanded liberal change from the new government. However both anarchism on the left and fascism on the right grew rapidly in the early 20th century. A revolt in 1909 in Catalonia was bloodily suppressed. Jensen (1999) argues that the defeat of 1898 led many military officers to abandon the liberalism that had been strong in the officer corps and turn to the right. They interpreted the American victory in 1898 as well as the Japanese victory against Russia in 1905 as proof of the superiority of willpower and moral values over technology. Over the next three decades, Jensen argues, these values shaped the outlook of Francisco Franco and other Falangists.

### Crisis of the Restoration system (1913–1931)

The bipartisan system began to collapse in the later years of the constitutional part of the reign of Alfonso XIII, with the dynastic parties largely disintegrating into factions: the conservatives faced a schism between datistas, mauristas and ciervistas. The liberal camp split into the mainstream liberals followers of the Count of Romanones (romanonistas) and the followers of Manuel García Prieto, the "democrats" (prietistas). An additional liberal albista faction was later added to the last two.
Spain's neutrality in World War I spared the country from carnage, yet the conflict caused massive economic disruption, with the country experiencing at the same time an economic boom (the increasing foreign demand of products and the drop of imports brought hefty profits) and widespread social distress (with mounting inflation, shortage of basic goods and extreme income inequality). A major revolutionary strike was called for August 1917, supported by the Spanish Socialist Workers' Party, the UGT and the CNT, seeking to overthrow the government. The Dato government deployed the army against the workers to brutally quell any threat to social order, sealing in turn the demise of the cabinet and undermining the constitutional order. The strike was one of the three simultaneous developments of a wider three-headed crisis in 1917 that cracked the Restoration regime, that also included a military crisis induced by the cleavage in the Armed Forces between Mainland and Africa-based ranks vis-à-vis the military promotion (and ensuing formation of juntas of officers that refused to dissolve upon request from the government), and a political crisis brought by the challenge posed by Catalan nationalism, whose bourgeois was emboldened by the economic upswing.
During the Rif War, the crushing defeat of the Spanish Army in the so-called "Disaster of Annual" in the summer of 1921 brought in a matter of days the catastrophic loss of the lives of about 9,000 Spanish soldiers and the loss of all occupied territory in Morocco that had been gained since 1912. This entailed the greatest defeat suffered by a European power in an African colonial war in the 20th century.
Alfonso XIII tacitly endorsed the September 1923 coup by General Miguel Primo de Rivera that installed a dictatorship led by the latter. The regime enforced the State of War all over the country from September 1923 to May 1925. Attempts to institutionalise the regime were taken, in the form of a single official party (the Patriotic Union) and a consultative chamber (the National Assembly).
Preceded by a partial retreat from vulnerable posts in the interior of the protectorate in Morocco, Spain (in joint action with France) turned the tides in Morocco in 1925, and the Abd el-Krim-led Republic of the Rif started to see the beginning of its end after the Alhucemas landing and ensuing seizure of Ajdir, the heart of the Riffian rebellion. The war had dragged on since 1917 and cost Spain $800 million. The Spanish officers of the war ended up taking the brutality of the colonial military practices to the mainland.
The late 1920s were prosperous until the worldwide Great Depression hit in 1929. In early 1930 bankruptcy and massive unpopularity forced the king to remove Primo de Rivera.
Primo de Rivera was replaced by Dámaso Berenguer's so-called dictablanda. The later ruler was in turn replaced by Admiral Aznar-Cabañas in February 1931, soon before the scheduled municipal elections of April 1931, which were considered a plebiscite on the Monarchy. Urban voters had lost faith in the monarch and voted for republican parties. The king fled the country and a republic was proclaimed on 14 April 1931.

## Second Spanish Republic (1931–36)

A provisional government presided by Niceto Alcalá Zamora was installed as the Republic, popularly nicknamed as "la niña bonita" ('the pretty girl'), was proclaimed on 14 April 1931, a democratic experiment at a time when democracies were beginning to descend into dictatorships elsewhere in the continent. A Constituent election was called for June 1931. The dominant bloc emerging from the election, an alliance of liberals and socialists, brought Manuel Azaña (who had undertaken a decisive reform as War minister in the provisional government by trying to democratize the Armed Forces) to premiership, heading from the on a number of coalition cabinets. While the Republican government was able to easily quell the first 1932 coup d'etat led by José Sanjurjo, the generals, who felt humiliated because of the military reform privately developed a strong contempt towards Azaña. The new parliament drafted a new constitution which was approved on 9 December 1931.
Political ideologies were intensely polarized. Regarding the crux of the role of the Church, within the Left people saw the former as the major enemy of modernity and the Spanish people, and the right saw it as the invaluable protector of Spanish values.
Under the Second Spanish Republic, women were allowed to vote in general elections for the first time. The Republic devolved substantial self-government to Catalonia and, for a brief period in wartime, also to the Basque Provinces.
The first cabinets of the Republic were center-left, headed by Niceto Alcalá-Zamora and Manuel Azaña. Economic turmoil, substantial debt, and fractious, rapidly changing governing coalitions led to escalating political violence and attempted coups by right and left.
Following the 1933 election, the right-wing Spanish Confederation of the Autonomous Right (CEDA), based on the Catholic vote, was set to enter the radical government. An armed rising of workers in October 1934, which reached its greatest intensity in Asturias, was forcefully put down. This in turn energized political movements across the spectrum, including a revived anarchist movement and new reactionary and fascist groups, such as the Falange and a revived Carlist movement.
A devastating 1936–39 civil war was won in 1939 by the rebel forces under Francisco Franco. It was supported by Nazi Germany and Fascist Italy. The rebels (backed among other by traditionalist Carlists, Fascist falangists and Far-right alfonsists) defeated the Republican loyalists (with variable support of Socialists, Liberals, Communists, Anarchists and Catalan and Basque nationalists), who were backed by the Soviet Union.

## Spanish Civil War (1936–39)

The Spanish Civil War was started by a military coup d'etat in 17–18 July 1936 against the Republican government. The coup, intending to prevent social and economic reforms carried by the new government, had been carefully plotted since the electoral right-wing defeat at the February 1936 election. The coup failed everywhere but in the Catholic heartland (Galicia, Old Castile and Navarre), Morocco, Zaragoza, Seville and Oviedo, while the rest of the country remained loyal to the Republic, including the main industrial cities (such as Madrid, Barcelona, Valencia and Bilbao), where the putschists were crushed by the combined action of workers and peasants.
The Republic looked to the Western democracies for help, but following an earlier commitment to provide assistance by French premier Léon Blum, by 25 July the latter had already backtracked on it, as to the mounting inner division within his country the British opposition to intervention added up, as the sympathies of the UK lied in the Rebel faction.
The Rebel faction enjoyed direct military support from Fascist Italy and Nazi Germany, while since the very beginning they also enjoyed the support of Salazarist Portugal, the power-base of one of the leading rebels, José Sanjurjo. The Soviet Union sold weapons to the Republican faction and Mexico sent in monetary aid as well as giving Republican refuges the option to seek refuge in Mexico, while left-wing sympathizers around the world went to Spain to fight in the International Brigades, set up by the Communist International. The conflict became a worldwide ideological battleground that pitted the left and many liberals against Catholics and conservatives. Worldwide there was a decline in pacifism and a growing sense that another world war was imminent, and that it was worth fighting for.
After the Spanish Civil War, the active agrarian population began to decline in Spain, the provinces with latifundia in Andalusia continued being the ones with the greatest number of day laborers; at the same time this was the region with the lowest literacy share.

### Political and military balance

The Spanish Republican government moved to Valencia, to escape Madrid, which was under siege by the Nationalists. It had some military strength in the Air Force and Navy, but it had lost nearly all of the Army. After opening the arsenals to arm local militias, it had little control over the Loyalist ground forces. Republican diplomacy proved ineffective, with only two useful allies, the Soviet Union and Mexico. Britain, France and 27 other countries had agreed to an arms embargo on Spain, and the United States went along. Nazi Germany and Fascist Italy both signed that agreement, but ignored it and sent supplies and vital help, including a powerful air force under German command, the Condor Legion. Tens of thousands of Italians arrived under Italian command. Portugal supported the Nationalists, and allowed the trans-shipment of supplies to Franco's forces. The Soviets sold tanks and other armaments for Spanish gold, and sent well-trained officers and political commissars. It organized the mobilization of tens of thousands of mostly communist volunteers from around the world, who formed the International Brigades.
In 1936, the Left united in the Popular Front and were elected to power. However, this coalition, dominated by the centre-left, was undermined both by the revolutionary groups such as the anarchist Confederación Nacional del Trabajo (CNT) and Federación Anarquista Ibérica (FAI) and by anti-democratic far-right groups such as the Falange and the Carlists. The political violence of previous years began again. There were gunfights over strikes; landless labourers began to seize land, church officials were killed and churches burnt. On the other side, right wing militias and hired gunmen assassinated left-wing activists. The Republican democracy never generated the consensus or mutual trust between the various political groups. As a result, the country slid into civil war. The right wing of the country and high ranking figures in the army began to plan a coup, and when Falangist politician José Calvo-Sotelo was shot by Republican police, they used it as a signal to act while the Republican leadership was confused and inert.

### Military operations

The Nationalists under Franco won the war, and historians continue to debate the reasons. The Nationalists were much better unified and led than the Republicans, who squabbled and fought amongst themselves endlessly and had no clear military strategy. The Army went over to the Nationalists, but it was very poorly equipped – there were no tanks or modern airplanes. The small navy supported the Republicans, but their armies were made up of raw recruits and they lacked both equipment and skilled officers and sergeants. Nationalist senior officers were much better trained and more familiar with modern tactics than the Republicans.
On 17 July 1936, General Francisco Franco brought the colonial army from Morocco to the mainland, while another force from the north under General Mola moved south from Navarre. Another conspirator, General Sanjurjo, was killed in a plane crash while being brought to join the military leaders. Military units were also mobilised elsewhere to take over government institutions. Franco intended to seize power immediately, but successful resistance by Republicans in the key centers of Madrid, Barcelona, Valencia, the Basque country, and other points meant that Spain faced a prolonged civil war. By 1937 much of the south and west was under the control of the Nationalists, whose Army of Africa was the most professional force available to either side. Both sides received foreign military aid: the Nationalists from Nazi Germany and Italy, while the Republicans were supported by organised far-left volunteers from the Soviet Union.
The Siege of the Alcázar at Toledo early in the war was a turning point, with the Nationalists successfully resisting after a long siege. The Republicans managed to hold out in Madrid, despite a Nationalist assault in November 1936, and frustrated subsequent offensives against the capital at Jarama and Guadalajara in 1937. Soon, though, the Nationalists began to erode their territory, starving Madrid and making inroads into the east. The North, including the Basque country fell in late 1937 and the Aragon front collapsed shortly afterwards. The bombing of Guernica on the afternoon of 26 April 1937 – a mission used as a testing ground for the German Luftwaffe's Condor Legion – was probably the most infamous event of the war and inspired Picasso's painting. The Battle of the Ebro in July–November 1938 was the final desperate attempt by the Republicans to turn the tide. When this failed and Barcelona fell to the Nationalists in early 1939, it was clear the war was over. The remaining Republican fronts collapsed, as civil war broke out inside the Left, as the Republicans suppressed the Communists. Madrid fell in March 1939.
The war cost between 300,000 and 1,000,000 lives. It ended with the total collapse of the Republic and the accession of Francisco Franco as dictator. Franco amalgamated all right wing parties into a reconstituted fascist party Falange and banned the left-wing and Republican parties and trade unions. The Church was more powerful than it had been in centuries.$^{:301–318}$
The conduct of the war was brutal on both sides, with widespread massacres of civilians and prisoners. After the war, many thousands of Republicans were imprisoned and up to 150,000 were executed between 1939 and 1943. Some 500,000 refugees escaped to France; they remained in exile for years or decades.

## Francoist Spain (1939–1975)

The Francoist regime resulted in the deaths and arrests of hundreds of thousands of people who were either supporters of the previous Second Republic of Spain or potential threats to Franco's state. They were executed, sent to prisons or concentration camps. According to Gabriel Jackson, the number of victims of the White Terror (executions and hunger or illness in prisons) between 1939 and 1943 was 200,000. Child abduction was also a wide-scale practice. The lost children of Francoism may reach 300,000.
During Franco's rule, Spain was officially neutral in World War II and remained largely economically and culturally isolated from the outside world. Under a military dictatorship, Spain saw its political parties banned, except for the official party (Falange). Labour unions were banned and all political activity using violence or intimidation to achieve its goals was forbidden.
Under Franco, Spain actively sought the return of Gibraltar by the United Kingdom, and gained some support for its cause at the United Nations. During the 1960s, Spain began imposing restrictions on Gibraltar, culminating in the closure of the border in 1969. It was not fully reopened until 1985.
Spanish rule in Morocco ended in 1967. Though militarily victorious in the 1957–58 Moroccan invasion of Spanish West Africa, Spain gradually relinquished its remaining African colonies. Spanish Guinea was granted independence as Equatorial Guinea in 1968, while the Moroccan enclave of Ifni had been ceded to Morocco in 1969. Two cities in Africa, Ceuta and Melilla, remain under Spanish rule and sovereignty.
The latter years of Franco's rule saw some economic and political liberalization (the Spanish miracle), including the birth of a tourism industry. Spain began to catch up economically with its European neighbors.
Franco ruled until his death on 20 November 1975, when control was given to King Juan Carlos. In the last few months before Franco's death, the Spanish state was paralyzed. This was capitalized upon by King Hassan II of Morocco, who ordered the 'Green March' into Western Sahara, Spain's last colonial possession.

## History of Spain (1975–present)
### Transition to democracy

The Spanish transition to democracy or new Bourbon restoration started with Franco's death on 20 November 1975, while its completion is marked by the electoral victory of the socialist PSOE on 28 October 1982.
Under its current (1978) constitution, Spain is a constitutional monarchy. It comprises 17 autonomous communities (Andalusia, Aragon, Asturias, Balearic Islands, Canary Islands, Cantabria, Castile and León, Castile–La Mancha, Catalonia, Extremadura, Galicia, La Rioja, Community of Madrid, Region of Murcia, Basque Country, Valencian Community, and Navarre) and two autonomous cities (Ceuta and Melilla).
Between 1978 and 1982, Spain was led by the Unión del Centro Democrático governments. In 1981 the 23-F coup d'état attempt took place. On 23 February Antonio Tejero, with members of the Guardia Civil entered the Congress of Deputies, and stopped the session, where Leopoldo Calvo Sotelo was about to be named prime minister. Officially, the coup d'état failed thanks to the intervention of King Juan Carlos. Spain joined NATO before Calvo-Sotelo left office. Along with political change came radical change in Spanish society. Spanish society had been extremely conservative under Franco, but the transition to democracy also began a liberalization of values and social customs.
After earning a sweeping majority at the October 1982 general election, the Spanish Socialist Workers' Party (PSOE) governed the country, with Felipe González as prime minister. On 1 January 1986, Spain joined the European Economic Community (EEC). A referendum on whether Spain should remain in NATO was held in March 1986. The ruling party, the PSOE, favoured Spain's permanence (a turn from their anti-NATO stance back in 1982). Meanwhile, the Conservative opposition (People's Coalition), called for abstention.
The country hosted the 1992 Summer Olympics in Barcelona and Seville Expo '92.

### Spain within the European Union (1993–present)

In 1996, the centre-right Partido Popular government came to power, led by José María Aznar. On 1 January 1999, Spain exchanged the peseta for the new Euro currency. The peseta continued to be used for cash transactions until January 1, 2002. On 11 March 2004 a number of terrorist bombs exploded on busy commuter trains in Madrid by Islamic extremists linked to Al-Qaeda, killing 191 and injuring thousands. The election, held three days later, was won by the PSOE, and José Luis Rodríguez Zapatero replaced Aznar as prime minister. As José María Aznar and his ministers at first accused ETA of the atrocity, it has been argued that the outcome of the election has been influenced by this event.
In the wake of its joining the EEC, Spain experienced an economic boom, cut painfully short by the financial crisis of 2008. During the boom years, Spain attracted a large number of immigrants, especially from the United Kingdom, but also including unknown but substantial illegal immigration, mostly from Latin America, eastern Europe and north Africa. Spain had the fourth largest economy in the Eurozone, but after 2008 the global economic recession hit Spain hard, with the bursting of the housing bubble and unemployment reaching over 25%, sharp budget cutbacks were needed. The GDP shrank 1.2% in 2012. Although interest rates were historically low, investments were not encouraged sufficiently by entrepreneurs. Losses were especially high in real estate, banking, and construction. Economists concluded in early 2013 that, "Where once Spain's problems were acute, now they are chronic: entrenched unemployment, a large mass of small and medium-sized enterprises with low productivity, and, above all, a constriction in credit." With the financial crisis and high unemployment, Spain is now suffering from a combination of continued illegal immigration paired with a massive emigration of workers, forced to seek employment elsewhere under the EU's "Freedom of Movement", with an estimated 700,000, or 1.5% of total population, leaving the country between 2008 and 2013.
Spain is ranked as a middle power able to exert modest regional influence. It has a small voice in international organizations; it is not part of the G8 and participates in the G20 only as a guest. Spain is part of the G6 (EU).