Spain's story is one of Europe's grand epics. It embraces the great struggles between Muslims and Christians of the Middle Ages, one of the world's biggest-ever empires, and, in the 20th century, civil war, dictatorship and a stunning return to democracy. As you travel around the country it's delightfully easy to get in touch with Spain's fascinating past through its countless well-preserved monuments and historical sites, and excellent museums.

Spain & the Ancient Civilisations

Spain can make a convincing claim to be the cradle of humanity in Western Europe: in 2007, Western Europe’s oldest confirmed remains – 1.2 million years old – of the genus Homo were discovered at Atapuerca, near the northern city of Burgos. But it was not until around 3000 years ago that Spain entered history's mainstream.

Phoenicians, Celts & Greeks

The Phoenicians were the first of the major civilisations of the ancient world to set their sights on Spain. From their base along what is now the southern Lebanese coast, the Phoenicians may have been the world’s first rulers of the sea. They were essentially traders rather than conquerors, and it was commerce that first brought them to Spain around 1000 BC. They arrived on Spanish shores bearing perfumes, ivory, jewellery, oil, wine and textiles, which they exchanged for Spanish silver and bronze.

Conquest may not have been the Phoenicians' aim, but as their reach expanded, so too did their need for safe ports around the Mediterranean rim. One of these was Carthage in modern-day Tunisia, founded in 814 BC; in Iberia they established coastal trading colonies at Cádiz (which they called Gadir), Almuñécar (Ex or Sex), Huelva (Onuba) and Málaga (Malaka). Cádiz, that breezy and thoroughly Andalucian city in Spain's deep south, can as a result make a pretty strong claim to be the oldest continuously inhabited settlement in Europe.

After the Phoenicians, Greek traders began to arrive further north along the coast. In the 7th century BC, the Greeks founded a series of trading settlements mainly along the Mediterranean coast – the biggest was Emporion (Empúries) at L'Escala in Catalonia.

The most important gifts of the Phoenicians and Greeks to Spain were not cities, only fragments of which remain today, but rather what they brought with them. The technology of working iron and several things now considered quintessentially Spanish – the olive tree, the grapevine and the donkey – arrived with the Phoenicians and Greeks, along with other useful skills and items such as writing, coins, the potter's wheel and poultry.

Around the same time as the Phoenicians brought iron technology to the south, Celts, originally from Central Europe, brought that knowledge – and beer making – to the north. Celts in the northwest typically lived in hill fort-villages known as castros, many of which can be visited today in Galicia and northern Portugal. On the meseta (the high tableland of central Spain) Celts merged with Iberians (the general name given to most inhabitants of the Iberian Peninsula at this time) to become what are known as Celtiberians.

The Romans

From about the 6th century BC, the Phoenicians and Greeks were pushed out of the western Mediterranean by newly independent Carthage, a former Phoenician colony that established a flourishing settlement on Ibiza. The next new Mediterranean power to arise was Rome, which defeated Carthage in the First and Second Punic Wars, and fought for control over the Mediterranean in the 3rd century BC. Between the two wars, Carthage conquered southern Spain. The Second Punic War (218–201 BC) saw Carthaginian general Hannibal march his elephants on from here and over the Alps to threaten Rome, but Rome's victory at Ilipa, near Seville, in 206 BC ultimately gave it control over the Iberian Peninsula. The first Roman town in Spain, Itálica, was founded near the battlefield soon afterwards.

The Romans held sway on the Iberian Peninsula for 600 years. It took them 200 years to subdue the fiercest of the local tribes, but by AD 50 most of Hispania (as the Romans called the peninsula) had adopted the Roman way of life.

Rome's legacy to Spain was incalculable, giving Hispania a road system, aqueducts, temples, theatres, amphitheatres and bathhouses, along with the religion that still predominates today – Christianity – and a Jewish population that was to play a big part in Spanish life for more than 1000 years. The languages now most widely spoken on the Iberian Peninsula – Castilian Spanish, Catalan, Galician and Portuguese – are all versions of the colloquial Latin spoken by Roman legionaries and colonists, filtered through 2000 years of linguistic mutation; the Basques, though defeated, were never romanised like the rest and hence their language never came within the Latin orbit.

It was also the Romans who first began to cut (for timber, fuel and weapons) the extensive forests that in their time covered half the Spanish meseta. In return, Hispania gave Rome gold, silver, grain, wine, fish, soldiers, emperors (Trajan, Hadrian, Theodosius) and the literature of Seneca, Martial, Quintilian and Lucan.

The Roman centuries were something of a golden age for Spain, but the Pax Romana (Roman Peace; the long, prosperous period of stability under the Romans) in Spain began to crumble in the 3rd and 4th centuries AD when Germanic tribes began to sweep down across the Pyrenees. The Visigoths, another Germanic people, sacked Rome itself in 410 but later became allies. When the Germanic Franks pushed the Visigoths out of Gaul in the 6th century, they settled in the Iberian Peninsula, making Toledo their capital.

Throughout their rule, the roughly 200,000 Visigoths maintained a precarious hold over the millions of more sophisticated Hispano-Romans, to the extent that the Visigoths tended to ape Roman ways. Nonetheless, the Roman era had come to an end.

Moorish Spain & La Reconquista

A recurring theme in early Spanish history is Spain's susceptibility to foreign invasion – to empires that rose and fell on Spanish soil but invariably came from elsewhere. In time, that pattern would transform into a struggle for the soul of Spain.

The Muslim Arrival

The death of the Prophet Mohammed in far-off Arabia in 632 sent shock waves far and wide, and Spain, too, would soon feel the effects. Under Mohammed’s successors, known as caliphs (from the Arabic word for ‘follower’), the new religion spread with extraordinary speed. Much of the Middle East was theirs by 656, and by 682 Islam had reached the shores of the Atlantic in Morocco. Spain, and with it Europe, now lay within sight.

The Muslims had chosen a good moment to arrive: with the disintegration of the Visigothic kingdom through famine, disease and strife among the aristocracy, the Iberian Peninsula was in disarray and ripe for invasion.

For all its significance, there is an element of farce to what happened next. If you believe the myth, the Muslims were ushered into Spain by the sexual misadventures of the last Visigoth king, Roderic, who reputedly seduced Florinda, the daughter of the governor of Ceuta on the Moroccan coast. The governor, Julian, sought revenge by approaching the Muslims with a plan to invade Spain, and in 711 Tariq ibn Ziyad, the Muslim governor of Tangier, landed at Gibraltar with around 10,000 men, mostly Berbers (indigenous North Africans).

Roderic's army was decimated, probably near Río Guadalete or Río Barbate in western Andalucía, and he is thought to have drowned while fleeing the scene. Visigothic survivors fled north and within a few years the Muslims had conquered the whole Iberian Peninsula, except for small areas behind the mountains of the Cordillera Cantábrica in the north. Their advance into Europe was only checked by the Franks at the Battle of Poitiers in 732.

Al-Andalus: The Early Years

The enlightened Islamic civilisation that would rule much of the Iberian Peninsula for centuries would be called Al-Andalus.

Initially Al-Andalus was part of the caliphate of Damascus, which ruled the Islamic world. Once again, as it had been in ancient times, Spain had become a distant outpost of someone else's empire. In 750, however, the Umayyads were overthrown in Damascus by a rival clan, the Abbasids, who shifted the caliphate to Baghdad. One aristocratic Umayyad survivor made his way to Spain and established himself in Córdoba in 756 as the independent emir of Al-Andalus, Abd ar-Rahman I. It was he who began construction of Córdoba's Mezquita, one of the world's greatest Islamic buildings. Just as importantly, Córdoba was the capital of an empire that relied on no foreign powers. For almost the first time, Spain (in this case, Al-Andalus) was both powerful and answerable only to itself.

Córdoba's Golden Age

From the middle of the 8th century to the mid-11th century, the frontier between Muslim and Christian territory lay across the north of the peninsula, roughly from southern Catalonia to northern Portugal, with a protrusion up towards the central Pyrenees. South of this line, Islamic cities such as Córdoba, Seville and Granada developed with beautiful palaces, mosques and gardens, universities, public baths and bustling zocos (markets). Al-Andalus' rulers allowed freedom of worship to Jews and Christians (known as Mozarabs) under their rule. Jews mostly flourished, but Christians had to pay a special tax, so most either converted to Islam or left for the Christian north. The Muslim settlers themselves were not a homogeneous group: beneath the Arab ruling class was a larger number of North African Berbers, and Berber rebellions weren't infrequent.

In 929, the ruler Abd ar-Rahman III gave himself the title caliph, launching the caliphate of Córdoba (929–1031), during which Al-Andalus reached its peak of power and lustre. Córdoba in this period was the biggest and most dazzling city in Western Europe. Astronomy, medicine, mathematics and botany flourished and one of the great Muslim libraries was established in the city.

Later in the 10th century, the fearsome Cordoban general Al-Mansur (or Almanzor) terrorised the Christian north with 50-odd forays in 20 years. He destroyed the cathedral at Santiago de Compostela in northwestern Spain in 997 and forced Christian slaves to carry its doors and bells to Córdoba, where they were incorporated into the great mosque. There was, it seemed, no limit to Córdoba's powers.

Al-Andalus: The Later Years

Just when it seemed that Córdoba's golden age would last forever, Al-Andalus turned the corner into a long, slow decline.

After Al-Mansur's death the caliphate collapsed into a devastating civil war, ending Umayyad rule, and in 1031 it finally broke up into dozens of taifas (small kingdoms).

Political unity was restored to Al-Andalus by the invasion of a strict Muslim Berber sect from North Africa, the Almoravids, in 1091. The Almoravids had conquered North Africa and were initially invited to the Iberian Peninsula to support Seville, one of the strongest taifas, against the growing Christian threat from the north. Seventy years later a second Berber sect, the Almohads, invaded the peninsula after overthrowing the Almoravids in Morocco. Both sects roundly defeated the Christian armies they encountered in Spain, and maintained the Muslim hold over the southern half of the peninsula.

Almohad power eventually disintegrated in the early 13th century because of internal infighting and continuing Christian military pressure from the north. Seville fell to the Christians in 1248, leaving the emirate of Granada (about half of modern Andalucía) as the last Muslim territory on the Iberian Peninsula. Ruled from the lavish Alhambra palace by the Nasrid dynasty, Granada saw Islamic Spain's final cultural flowering as the Christian armies of the Reconquista were closing in.

La Reconquista

The Christian reconquest of the Iberian Peninsula began in about 722 at Covadonga, Asturias, and ended with the fall of Granada in 1492. Between these two dates lay almost eight centuries of misadventures, stirring victories and missed opportunities, during which different Christian kingdoms were almost as often at war with each other as with Muslims.

An essential ingredient in the Reconquista was the cult of Santiago (St James), one of the 12 Apostles. In about the 820s, the saint's supposed tomb was discovered in Galicia. The city of Santiago de Compostela grew around the site, becoming the third-most-popular medieval Christian pilgrimage goal, after Rome and Jerusalem. Christian generals experienced visions of Santiago before forays against the Muslims, and Santiago became the inspiration and special protector of soldiers in the Reconquista, earning the sobriquet Matamoros (Moor-slayer). Today he is the patron saint of Spain.

Castilla Rises

Covadonga lies in the Picos de Europa mountains in Asturias, where some Visigothic nobles took refuge after the Muslim conquest. Christian versions of the 722 battle there tell of a small band of fighters under their leader, Pelayo, defeating an enormous force of Muslims; Muslim accounts make it a rather less important skirmish. Whatever the facts of Covadonga, by 757 Christians had clawed back nearly a quarter of the Iberian Peninsula.

The Asturian kingdom eventually moved its capital south to León and became the kingdom of León, which spearheaded the Reconquista until the Christians were set on the defensive by Al-Mansur in the 10th century. Castilla, initially a small principality within León, developed into the dominant Reconquista force as hardy adventurers set up towns in the no man's land of the Duero basin. It was the capture of Toledo in 1085, by Alfonso VI of Castilla, that led the Seville Muslims to call in the Almoravids from North Africa.

In 1212 the combined armies of the Christian kingdoms routed a large Almohad force at Las Navas de Tolosa in Andalucía (near the modern town of Santa Elena). This was the beginning of the end for Al-Andalus: León took key towns in Extremadura in 1229 and 1230; Aragón took Valencia in the 1230s; Castilla's Fernando III El Santo (Ferdinand the Saint) took Córdoba in 1236 and Seville in 1248; and the Muslims were expelled from Portugal in 1249. The sole surviving Muslim state on the peninsula was now the emirate of Granada.

Granada Falls

In 1476 Emir Abu al-Hasan of Granada refused to pay any more tribute to Castilla, spurring the Reyes Católicos (Catholic Monarchs) – Isabel, queen of Castilla, and her husband, Fernando, king of Aragón – to launch the Reconquista's final crusade, against Granada. With an army largely funded by Jewish loans and the Catholic Church, the Christians took full advantage of a civil war within the Granada emirate, and on 2 January 1492 Isabel and Fernando entered the city of Granada at the beginning of what turned out to be the most momentous year in Spanish history.

The surrender terms were fairly generous to Boabdil, the last emir, who got the Alpujarras valleys south of Granada and 30,000 gold coins. History has been less kind. Whether true or not, it is often recounted how Boabdil turned for one last tearful look at his beloved Granada as he headed into exile, whereupon his mother scolded him by saying: 'Do not weep like a woman for what you could not defend like a man!' The remaining Muslims were promised respect for their religion, culture and property, but this didn't last long.

Eight centuries after it began, Al-Andalus was no more.

The Spanish Inquisition

Spain's new Catholic rulers made it clear from the beginning that any enlightened policies of religious coexistence were a thing of the past.

Not content with territorial conquest, the Catholic Monarchs' zeal led to the founding of the Spanish Inquisition to root out those believed to be threatening the Catholic Church. The Inquisition's leading figure was Grand Inquisitor Tomás de Torquemada, who was appointed Queen Isabel's personal confessor in 1479. He was, centuries later, immortalised by Dostoevsky as the articulate Grand Inquisitor who puts Jesus himself on trial in The Brothers Karamazov, and satirised in Monty Python's Flying Circus.

The Inquisition focused first on conversos (Jews converted to Christianity), accusing many of continuing to practise Judaism in secret; in an interesting footnote to history, Torquemada was himself born to converso parents.

During the Inquisition, the ‘lucky’ sinners had their property confiscated (this served as a convenient fund-raiser for the wars against Granada). The condemned were then paraded through towns wearing the sambenito, a yellow shirt emblazoned with crosses that was short enough to expose their genitals, then marched to the doors of the local church and flogged.

If you were unlucky, you underwent unimaginable tortures before going through an auto-da-fé, a public burning at the stake. Those who recanted and kissed the cross were garrotted before the fire was set, while those who just recanted were burnt quickly with dry wood. If you stayed firm and didn't recant, the wood used for the fire was green and slow-burning.

In the 15 years that Torquemada was Inquisitor General of the Castilian Inquisition, he ran some 100,000 trials and sent about 2000 people to burn at the stake. On 31 March 1492, Fernando and Isabel, on Torquemada's insistence, issued their Edict of Expulsion, as a result of which all Jews who refused Christian baptism were forced to leave Spain within two months on pain of death. Up to 100,000 converted, but some 200,000 – the first Sephardic Jews – left Spain for other Mediterranean destinations. The bankrupt monarchy seized all unsold Jewish property. A talented middle class was gone.

Cardinal Cisneros, Torquemada's successor as overseer of the Inquisition, tried to eradicate Muslim culture, too. In the former Granada emirate he carried out forced mass baptisms, burnt Islamic books and banned the Arabic language. After a revolt in Andalucía in 1500, Muslims were ordered to convert to Christianity or leave. Most (around 300,000) underwent baptism and stayed, becoming known as moriscos (converted Muslims), but their conversion was barely skin deep and they never assimilated. The moriscos were finally expelled between 1609 and 1614.

Spain's Empires

Having secured the Iberian Peninsula as their own, the Catholic Monarchs turned their attention elsewhere. The conquest of Granada coincided neatly with the opening up of a whole new world of opportunity for a confident Christian Spain. Columbus' voyage to the Americas, in the very same year as Granada fell, presented an entire new continent in which the militaristic and crusading elements of Spanish society could continue their efforts.

Conquering a New World

In April 1492 the Catholic Monarchs granted the Genoese sailor Christopher Columbus (Cristóbal Colón in Spanish) funds for his voyage across the Atlantic in search of a new trade route to the Orient.

Columbus sailed from the Andalucian port of Palos de la Frontera on 3 August 1492, with three small ships and 120 men. After a near mutiny as the crew despaired of sighting land, they finally arrived on the island of Guanahaní, in the Bahamas, and went on to find Cuba and Hispaniola. Columbus returned to a hero's reception from the Catholic Monarchs in Barcelona, eight months after his departure. Columbus made three more voyages, founding the city of Santo Domingo on Hispaniola, finding Jamaica, Trinidad and other Caribbean islands, and reaching the mouth of the Orinoco and the coast of Central America. But he died impoverished in Valladolid in 1506, still believing he had reached Asia.

Brilliant but ruthless conquistadors such as Hernán Cortés and Francisco Pizarro followed Columbus' trail, seizing vast tracts of the American mainland for Spain. By 1600 Spain controlled nearly all of present-day Mexico and Central America, a large strip of South America, all the biggest Caribbean islands, and Florida. The new colonies sent huge cargoes of silver, gold and other riches back to Spain, where the crown was entitled to one-fifth of the bullion (the quinto real, or royal fifth). Seville enjoyed a monopoly on this trade and grew into one of Europe's richest cities.

Entangled in the Old World

It wasn't just the Americas that the Catholic Monarchs thought should be theirs. Isabel and Fernando embroiled Spain in European affairs by marrying their five children into the royal families of Portugal, the Holy Roman Empire and England. After Isabel's death in 1504 and Fernando's in 1516, their thrones passed to their grandson Carlos I (Charles I), who arrived in Spain from Flanders in 1517, aged 17. In 1519 Carlos also succeeded to the Habsburg lands in Austria and was elected Holy Roman Emperor (as Charles V) – meaning he now ruled all of Spain, the Low Countries, Austria, several Italian states, parts of France and Germany, and the expanding Spanish colonies in the Americas.

For all Spain's apparent power, European conflicts soaked up the bulk of the monarchy's new American wealth, and a war-weary Carlos abdicated shortly before his death in 1556, retiring to the Monasterio de Yuste in Extremadura and dividing his many territories between his son Felipe II (Philip II; r 1556–98) and his brother Fernando.

Felipe got the lion's share, including Spain, the Low Countries and the American possessions, and presided over the zenith of Spanish power, though his reign is a study in contradictions. He enlarged the American empire and claimed Portugal on its king's death in 1580, but he lost Holland after a long, drawn-out rebellion. His navy defeated the Ottoman Turks at Lepanto in 1571, but the Spanish Armada of 1588 was routed by England. He was a fanatical Catholic who spurred the Inquisition to new persecutions, yet he readily allied with Protestant England against Catholic France. He received greater flows of silver than ever from the Americas but went bankrupt.

Like his father, Felipe died in a monastery – the immense one at San Lorenzo de El Escorial, which he himself had commissioned, and which stands as a sombre monument to his reign and to the contradictions of Spain's colonial era.

Riches to Rags

In Spain's finest hour, at a time when it ruled large swaths of the world, the country's rulers sowed the seeds of its disintegration. So much of the fabulous wealth that accrued from Spain's American and other colonies was squandered on lavish royal lifestyles and on indulgences that did little to better the lives of ordinary Spaniards. The result was a deeply divided country that would for centuries face repeated battles of royal succession and its fair share of external wars, while the bulk of the population got poorer and poorer.

Out of Step with Europe

At one level, a flourishing arts scene in 17th-century Spain created the illusion of a modern European nation. Spain was being immortalised in paint by great artists such as Velázquez, El Greco, Zurbarán and Murillo, and in words by the likes of Miguel de Cervantes (author of Don Quijote) and the prolific playwright Lope de Vega.

And yet weak, backward-looking monarchs, a highly conservative Church and an idle nobility allowed the economy to stagnate, leading to food shortages and gross inequalities between the haves and the have-nots. Spain lost Portugal and faced revolts in Catalonia, Sicily and Naples. Silver shipments from the Americas shrank disastrously. And the sickly Carlos II (Charles II; r 1665–1700), known as El Hechizado (the Bewitched), failed to produce children, a situation that led to the War of the Spanish Succession (1702–13). Felipe V (Philip V; r 1700–46), to whom Carlos II had bequeathed the Spanish throne, managed to hold on to it, but during the war Spain lost its last possessions in the Low Countries to Austria, and Gibraltar and Menorca to Britain. Felipe V was the first of the Bourbon dynasty, still in place today.

This was Europe's Age of Enlightenment, but Spain's powerful Church and Inquisition were at odds with the rationalism that trickled in from France. Two-thirds of the land was in the hands of the nobility and Church, and inequality and unrest were rife.

France Invades

When France's Louis XVI, cousin to Spain's Carlos IV (Charles IV; r 1788–1808), was guillotined in 1793 in the aftermath of the French Revolution, Spain declared war on France, only to make peace with the French Republic two years later. In 1805 a combined Spanish-French navy was beaten by the British fleet, under Admiral Nelson, off Andalucía's Cabo de Trafalgar, putting an end to Spanish sea power.

In 1807, French forces poured into Spain, supposedly on the way to Portugal, but by 1808 this had become a French occupation of Spain, and Carlos IV was forced to abdicate in favour of Napoleon's brother Joseph Bonaparte (José I).

In Madrid crowds revolted, as immortalised by Goya in his paintings El dos de mayo and El tres de mayo, which now hang in Madrid's Museo del Prado. Across the country Spaniards took up arms guerrilla-style, reinforced by British and Portuguese forces led by the Duke of Wellington. A national Cortes (parliament) meeting at Cádiz in 1812 drew up a new liberal constitution, incorporating many of the principles of the American and French prototypes. The French were finally driven out after their defeat at Vitoria in 1813.

Spain's Decline

Although momentarily united to see off the French, Spain was deeply divided, not to mention increasingly backward and insular. For much of the 19th century, internal conflicts raged between liberals (who wanted vaguely democratic reforms) and conservatives (the Church, the nobility and others who preferred the earlier status quo).

Uncertainties over royal succession resulted in the First Carlist War (1833–39). During the war, violent anticlericalism emerged, religious orders were closed and, in the Disentailment of 1836, church property and lands were seized and auctioned off by the government. It was the army alone that emerged victorious from the fighting. Another Carlist War (1872–76) followed, this time between the supporters of not just two but three claimants to the throne.

In 1873 the liberal-dominated Cortes proclaimed the country a federal republic. But this First Republic could not control the regions, and the army put Queen Isabel II's son Alfonso on the throne as Alfonso XII (r 1874–85), in a coalition with the Church and landowners.

Barely able to hold itself together, Spain had little chance of maintaining its few remaining colonies. In 1898, Spain lost Cuba, the Philippines, Guam and Puerto Rico after being defeated in the Spanish-American War by the USA.

For a country that had ruled one of the greatest empires of the age, this sealed an ignominious fall from grace.

The Spanish Civil War

The Spanish Civil War (1936–39) was a long time coming. In many ways, the seeds of division were sown centuries before in the profound inequalities that flowed from Spain's colonial riches, and in the equally profound social divisions that began to surface in the 19th century.

Seeds of War

By the early years of the 20th century, Spain was locked in an unending power struggle between left-wing and conservative forces, with neither able to maintain the upper hand for long.

For a time, the left seemed ascendant. Anarchism and socialism both gained large followings and founded powerful unions. In the 1890s and the 1900s, anarchists bombed Barcelona's Liceu opera house, assassinated two prime ministers and killed 24 people with a bomb at King Alfonso XIII's wedding to Victoria Eugenie of Battenberg in May 1906. Parallel to the rise of the left came the growth of Basque and Catalan separatism. In Catalonia this was led by business interests who wanted to pursue policies independent of Madrid; in the Basque Country, nationalism emerged in the 1890s in response to a flood of Castilian workers into Basque industries: some Basques considered these migrants a threat to their identity. In 1909 a contingent of Spanish troops was wiped out by Berbers in Spanish Morocco. The government’s decision to call up Catalan reservists sparked the so-called Semana Trágica (Tragic Week) in Barcelona, which began with a general strike and turned into a frenzy of violence. The government responded by executing many workers.

Spain stayed neutral during WWI but remained a deeply troubled nation. In 1921, 10,000 Spanish soldiers were killed by Berbers at Anual in Morocco, and two years later General Miguel Primo de Rivera, an eccentric Andalucian aristocrat, led an army uprising and established a mild dictatorship, resigning in 1930 in the midst of an economic downturn following the Wall Street Crash. King Alfonso XIII departed for exile in 1931 and Spain's Second Republic was launched.

National elections in 1931 brought in a government composed of socialists, republicans and centrists. A new constitution gave women the vote, granted autonomy-minded Catalonia its own parliament, legalised divorce, stripped Catholicism of its status as the official religion, and banned priests from teaching. But Spain lurched back to the right in elections in 1933. One new force on the right was the fascist Falange, led by José Antonio Primo de Rivera, son of the 1920s dictator.

By 1934, violence was spiralling out of control. Catalonia declared itself independent (within a putative federal Spanish republic), and workers' committees took over the northern mining region of Asturias. A violent campaign against the Asturian workers by the Spanish Legion (set up to fight Moroccan tribes in the 1920s), led by generals Francisco Franco and José Millán Astray, split the country firmly into left and right.

In the February 1936 elections, the right-wing National Front was narrowly defeated by the left-wing Popular Front, with communists at the fore.

Something had to give.

The Civil War Begins

On 17 July 1936, the Spanish army garrison in Melilla, North Africa, rose up against the left-wing Popular Front government, followed the next day by garrisons on the mainland. The leaders of the plot were five generals, among them Francisco Franco. The civil war had begun.

The war would split communities, families and friends, kill an estimated 350,000 Spaniards (some writers say 500,000), and cause untold damage and misery. Both sides committed atrocious massacres and reprisals. The rebels, who called themselves Nationalists because they believed they were fighting for Spain, shot or hanged tens of thousands of supporters of the Republic. Republicans did likewise to Nationalist sympathisers, including some 7000 priests, monks and nuns.

At the start of the war many of the military and the Guardia Civil police force went over to the Nationalists, whose campaign quickly took on overtones of a crusade against the enemies of God. In Republican areas, anarchists, communists or socialists ended up running many towns and cities, and social revolution followed.

Nationalist Advance

Most cities with military garrisons fell immediately into Nationalist hands – this included almost everywhere north of Madrid except Catalonia and the north coast, plus parts of Andalucía. Franco's force of legionnaires and Moroccan mercenaries was airlifted to Seville by German war planes in August. Essential to the success of the revolt, the force moved north through Extremadura towards Madrid, wiping out fierce resistance in some cities. At Salamanca in October, Franco pulled all the Nationalists into line behind him.

Madrid, reinforced by the first battalions of the International Brigades (armed foreign idealists and adventurers organised by the communists), repulsed Franco's first assault in November and then endured, under communist inspiration, over two years' siege. But the International Brigades never numbered more than 20,000 and couldn't turn the tide against the better-armed and -organised Nationalist forces.

Nazi Germany and Fascist Italy supported the Nationalists with planes, weapons and men (75,000 from Italy, 17,000 from Germany), turning the war into a testing ground for WWII. The Republicans had some Soviet planes, tanks, artillery and advisers, but other countries refused to become involved (although some 25,000 French fought on the Republican side).

Republican Quarrels

With Madrid besieged, the Republican government moved to Valencia in late 1936 to preside over the quarrelsome factions on its side, which encompassed anarchists, communists, moderate democrats and regional separatists.

In April 1937 German planes bombed the Basque town of Gernika (Guernica), causing terrible casualties; this became the subject of Picasso's famous pacifist painting, which now hangs in Madrid’s Centro de Arte Reina Sofía. All the north coast fell to the Nationalists that year, while Republican counter-attacks near Madrid and in Aragón failed. Meanwhile, divisions among the Republicans erupted into fierce street fighting in Barcelona, with the Soviet-influenced communists completely crushing the anarchists and Trotskyites, who had run the city for almost a year. The Republican government moved to Barcelona in autumn 1937.

Nationalist Victory

In early 1938, Franco repulsed a Republican offensive at Teruel in Aragón, then swept eastward with 100,000 troops, 1000 planes and 150 tanks, isolating Barcelona from Valencia. In July the Republicans launched a last offensive in the Ebro Valley. This bloody encounter, won by the Nationalists, cost 20,000 lives. The USSR withdrew from the war in September 1938, and in January 1939 the Nationalists took Barcelona unopposed. The Republican government and hundreds of thousands of supporters fled to France. The Republicans still held Valencia and Madrid, and had 500,000 people under arms, but in the end their army simply evaporated. The Nationalists entered Madrid on 28 March 1939 and Franco declared the war over on 1 April.

Franco's Dictatorship

Bloodied and battered Spain may have been after the Civil War, but there was no peace dividend: Spain's new ruler, General Francisco Franco, began as he meant to continue.

The Early Franco Years

An estimated 100,000 people were killed or died in prison in the years immediately following the war. The hundreds of thousands imprisoned included many intellectuals and teachers; others fled abroad, depriving Spain of a generation of scientists, artists, writers, educators and more.

Though Franco promised Hitler an alliance, Spain remained on the sidelines of WWII. In 1944 Spanish leftists launched an attack on Franco's Spain from France; this attack failed. Small leftist guerrilla units continued a hopeless struggle in parts of the north, Extremadura and Andalucía until the 1950s.

After WWII Franco's Spain was excluded from the UN and NATO, and suffered a UN-sponsored trade boycott that helped turn the late 1940s into Spain's años de hambre (years of hunger). But with the onset of the Cold War, the US wanted bases in Spain, and Franco agreed to the establishment of four, in return for large sums of aid. In 1955 Spain was admitted to the UN.

Franco's Spain

Franco ruled absolutely, never allowing any one powerful lobby – the Church, the army, the Movimiento Nacional (the only legal political party) or the bankers – to dominate. Regional autonomy aspirations were not tolerated. The army provided many government ministers and enjoyed a most generous budget. And Catholic supremacy was fully restored.

In 1959 a new breed of technocrats in government, linked to the Catholic group Opus Dei, engineered a Stabilisation Plan, which brought an economic upswing. Spanish industry was modernised, transport was updated, and new dams provided irrigation and hydropower.

The recovery was funded in part by US aid and remittances from more than a million Spaniards who had gone to work abroad, but above all it was funded by tourism, which was developed initially along Andalucía's Costa del Sol and Catalonia's Costa Brava. By 1965 the number of tourists arriving in Spain was 14 million a year. These were the so-called años de desarrollo (years of development). Industry took off, foreign investment poured in, and the services and banking sectors blossomed. In 1960 fewer than 70,000 cars were on the road in Madrid. Ten years later, more than half a million clogged the capital's streets.

Spaniards' standard of living was improving, but the jails were full of political prisoners and large garrisons were still maintained outside every major city. From 1965 opposition to Franco's regime became steadily more vocal. The universities were scenes of repeated confrontation, and clandestine trade unions began to make themselves heard. In the Basque Country the terrorist group Euskadi Ta Askatasuna (ETA; Basque Homeland and Freedom) began to fight for Basque independence. Its first significant action outside the Basque Country was the 1973 assassination in Madrid of Admiral Carrero Blanco, Franco's prime minister and designated successor.

In what seemed like a safe bet, Franco then chose as his successor Prince Juan Carlos, the Spanish-educated grandson of Alfonso XIII. In 1969 Juan Carlos swore loyalty to Franco and the Movimiento Nacional. Cautious reforms by Franco's last prime minister, Carlos Arias Navarro, provoked violent opposition from right-wing extremists, and Spain seemed to be sinking into chaos when Franco died on 20 November 1975.

Democratic Spain

Spain's way forward was hard to discern on Franco's death. The country remained as divided as ever and at its helm was an untested Franco protégé. But, not for the first time in Spanish history, not all was as it seemed.

The Transition

Juan Carlos I, aged 37, took the throne on 22 November 1975, two days after Franco's death. The new king's links with the dictator inspired little confidence in a Spain now clamouring for democracy, but Juan Carlos had kept his cards close to his chest. In July 1976 he appointed Adolfo Suárez, a 43-year-old former Franco apparatchik with film-star looks, as prime minister. To general surprise, Suárez got the Cortes (parliament) to approve a new, two-chamber parliamentary system, and in 1977 political parties, trade unions and strikes were all legalised. Franco's Movimiento Nacional was abolished.

Suárez' centrist party, the Unión de Centro Democrático (UCD; Central Democratic Union), won nearly half the seats in the new Cortes in 1977. A new constitution in 1978 made Spain a parliamentary monarchy with no official religion. In response to a fever for local autonomy, principally in Catalonia, the Basque Country and Galicia, by 1983 the country was divided into 17 'autonomous communities' with their own regional governments controlling a range of policy areas. Personal and social life enjoyed a rapid liberation after Franco. Contraceptives, homosexuality and divorce were legalised, and the Madrid party and arts scene known as la movida madrileña formed the epicentre of a newly unleashed hedonism that still reverberates through Spanish life.

The Suárez government granted a general amnesty for deeds committed in the civil war and under the Franco dictatorship. There were no truth commissions or trials for the perpetrators of atrocities. For the next three decades, Spain cast barely a backward glance.

A Maturing Democracy

The main left-of-centre party, the Partido Socialista Obrero Español (PSOE; Spanish Socialist Workers' Party), led by a charismatic young lawyer from Seville, Felipe González, came second in the 1977 election and then won power with a big majority in 1982. González was to be prime minister for 14 years. The PSOE's young and educated leadership came from the generation that had opened the cracks in the Franco regime in the late 1960s and early 1970s. Unemployment rose from 16% to 22% by 1986, but that same year, Spain joined the European Community (now the EU), bringing on a five-year economic boom. The middle class grew ever bigger, the PSOE established a national health system and improved public education, and Spain's women streamed into higher education and jobs.

In 1992 – the 500th anniversary of the fall of Granada and Columbus' first voyage to the Americas – Spain celebrated its arrival in the modern world by staging the Barcelona Olympics and the Expo 92 world fair in Seville. The economy, however, was in a slump and the PSOE was mired in scandals. It came as no surprise when the PSOE lost the 1996 general election.

The party that won the 1996 election was the centre-right Partido Popular (PP; People's Party), led by José María Aznar, a former tax inspector from Castilla y León. Aznar promised to make politics dull, and he did, but he presided over eight years of solid economic progress, winning the 2000 election as well. The PP cut public investment and sold off state enterprises, and liberalised sectors such as telecommunications; during the Aznar years Spain's economy grew a lot faster than the EU average, while unemployment fell dramatically.

Troubled Times

On 11 March 2004, Madrid was rocked by 10 bombs on four rush-hour commuter trains heading into the capital's Atocha station. When the dust cleared, 191 people had died and 1755 were wounded, many of them seriously. Perpetrated by an Islamic group with links to al-Qaeda, this was the biggest such terror attack in the nation's history.

In a stunning reversal of pre-poll predictions, the PP, which insisted that the ETA was responsible despite overwhelming evidence to the contrary, was defeated by the PSOE in elections three days after the attack.

The new socialist government of José Luis Rodríguez Zapatero gave Spain a makeover by introducing a raft of liberalising social reforms. Gay marriage was legalised, Spain's arcane divorce laws were overhauled, almost a million illegal immigrants were granted residence, and a law seeking to apportion blame for the crimes of the Civil War and Franco dictatorship entered the statute books. Although Spain's powerful Catholic Church cried foul over many of the reforms, the changes played well with most Spaniards. Spain's economy was booming – the envy of Europe.

And then it all fell apart.

Spain's economy went into free fall in late 2008 with the global credit crunch, the bursting of the country's property bubble, and the international slump. In an economy heavily dependent on tourism and construction, two exceptionally vulnerable industries during economic downturns, unemployment rose above 27% (six million people) by 2013, and catastrophic youth-unemployment rates nudged 60%. Young professionals fled the country in unprecedented numbers. A wave of anger at corruption and the political and financial elite spread across Spain, spearheaded by a protest movement known as Los Indignados (The Indignant Ones), who camped out in central Madrid for months from 15 May 2011 in what was the forerunner to many similar movements around the world, including Occupy Wall Street.

Zapatero's government waited painfully long to recognise the severity of the crisis and was replaced, in the elections of November 2011, by a PP government led by Mariano Rajoy that launched a deep austerity drive that cut into the generous welfare state on which Spaniards had come to depend. Spanish banks were bailed out by the EU to the tune of €100 billion. The conservative government also turned back the liberalising reforms of the socialists, introducing some of Europe's strictest anti-abortion laws and restoring the role of the Catholic Church in education.

That the country remained firmly democratic, and the protests largely peaceful, however, were encouraging signs of how far Spain has come, given its tumultuous modern history.