Catalonia's bid for independence from Spain explained
The drive for Catalan independence has been boosted by the separatists' triumph in a snap regional election.
The result backfired on Spanish Prime Minister Mariano Rajoy, who imposed direct rule after the Catalan parliament declared independence on 27 October.
It is Spain's biggest political crisis since democracy was restored in 1975, after the death of military dictator Gen Francisco Franco.
So will Catalonia become independent?
Possibly, but it would be in the long term. First come tough negotiations on forming a Catalan coalition government.
The election result is a landmark in the nationalists' long campaign for independence. It proves - legally - the strength of support for their cause.
They won 70 seats in the 135-seat Catalan parliament - just two fewer than their previous total.
So, a slim majority for them - but it is complicated.
For a start, there is rivalry between ousted Catalan President Carles Puigdemont and his jailed deputy, Oriol Junqueras.
Mr Puigdemont campaigned via videolink from self-imposed exile in Belgium - and it worked, as his JxCat party got the most pro-independence votes.
A triumphant Mr Puigdemont called for direct talks with Mr Rajoy, but the Spanish leader rebuffed him soon after, saying only that he was open to dialogue with the leader of a future Catalan government.
There is also an ideological split between JxCat and the left-wing separatists of CUP.
The liberal Citizens (Ciudadanos) party, or Cs, actually came top and it wants Catalonia to remain united with Spain. So it will be a powerful voice, whatever happens. But analysts believe Cs would struggle to form a viable governing coalition.
Mr Rajoy's conservative Popular Party (PP) had a disastrous election, winning just three seats.
But for the time being Mr Rajoy will keep control of the region, because he imposed direct rule in October, invoking Article 155 of the constitution. That extraordinary measure was a first in post-Franco Spain.
The Madrid government said Article 155 was a temporary measure.
Mr Puigdemont and four separatist allies fled to Belgium to avoid arrest. Other separatist leaders were jailed, though most were then freed on bail.
They all face charges of rebellion, sedition and embezzlement of official funds. Guilty verdicts would mean long prison sentences, but it is not clear how far the Spanish prosecution will go.
- Catalan political landscape as divided as ever
- Could Catalonia make a success of independence?
- Catalonia - history, politics and religion
How did we get here?
Catalonia is one of Spain's wealthiest and most productive regions and has a distinct history dating back almost 1,000 years.
Before the Spanish Civil War it enjoyed broad autonomy but that was suppressed under Gen Franco.
When Franco died, the region was granted autonomy again under the 1978 constitution and prospered as part of the new, democratic Spain.
A 2006 statute granted even greater powers, boosting Catalonia's financial clout and describing it as a "nation", but Spain's Constitutional Court reversed much of this in 2010.
The 2008 financial crash and Spanish public spending cuts fuelled local resentment and separatism.
Following a symbolic referendum in November 2014, outlawed by Spain, separatists won the 2015 regional election and went on to win a full referendum on 1 October 2017, which was also banned and boycotted by supporters of the union.
Turnout in the referendum was only 43%.
The sight of Spanish national police beating voters, and politicians being jailed, revived disturbing memories, for some, of the Franco dictatorship.
In a febrile atmosphere the separatist majority in the Catalan parliament declared independence on 27 October.
Using the Article 155 emergency powers, Madrid then called the snap election for 21 December.
Some argue that if Madrid made concessions, such as restoring the 2006 autonomy statute, it could defuse the crisis.
Does Catalonia have a good claim to nationhood?
It is certainly long-lived. It has its own language and distinctive traditions, and a population nearly as big as Switzerland's (7.5 million).
It is also a vital part of the Spanish state, locked in since the 15th Century, and - according to supporters of independence - subjected periodically to repressive campaigns to make it "more Spanish".
During this crisis, however, the Catalan economy has suffered. Thousands of businesses, including major banks and energy firms, have moved their headquarters out of the region.
The EU has treated the crisis as an internal matter for Spain, deaf to the separatists' pleas for support.
Internationally it would be hard for Catalonia to win recognition. New states mostly emerge from situations where ethnic groups have been victims of genocide or other major human rights abuses.
Kosovo was a huge humanitarian crisis for Europe - even so, many countries refuse to recognise it as independent.
What does Catalonia mean to the rest of Spain?
Depending on your view, Barcelona is primarily either Catalonia's capital or Spain's second city.
It has become one of the EU's best-loved city break destinations, famed for its 1992 Summer Olympics, trade fairs, football and tourism.
Catalonia is one of Spain's wealthiest regions, making up 16% of the national population and accounting for almost 19% of Spanish GDP.
Generations of people from poorer parts of Spain have moved there for work, forming strong family bonds with regions such as Andalusia.
Does Madrid really milk Catalonia?
There is a widespread feeling that the central government takes much more than it gives back.
But the complexity of budget transfers makes it hard to judge exactly how much more Catalans contribute in taxes than they get back from investment in services, such as schools and hospitals.
According to 2014 figures, Catalonia paid about €10bn (£9bn; $12bn) more to Spain's tax authorities than it received in spending - the equivalent of 5% of its GDP.
Meanwhile, state investment in Catalonia has dropped: the 2015 draft national budget allocated 9.5% to Catalonia - compared with nearly 16% in 2003.