Catalan separatist leaders won a dramatic victory in Europe's top court on Thursday, with a ruling that even jailed MEPs enjoy parliamentary immunity.
The European Court of Justice ruled that Spain should have released independence activist Oriol Junqueras from prison to allow him to take office after May's European elections.
The judgement also appears to clear the way for two Catalan leaders who sought refuge in Belgium to seek to take up their seats in the European Parliament.
Once elected, Junqueras enjoyed an immunity that "entails lifting any measure of provisional detention imposed prior to the declaration of that member's election," ECJ president Koen Lenaerts said.
Reading the judgement, Lenaerts said anyone elected to the European Parliament enjoys the legal immunities of a Member of the European Parliament (MEP) from the moment that results are declared.
At the time of May's European parliamentary elections, Junqueras was in pre-trial detention in Spain facing charges linked to his role in organising a banned Catalan independence referendum.
He nevertheless won office, but was prevented from leaving jail to attend a Spanish swearing in ceremony, and thus also from travelling to Brussels to take up his post.
On Twitter, Junqueras's account rejoiced: "Justice came from Europe. Our rights and those of the 2,000,000 citizens who voted for us were violated. Annulment of the sentence and freedom for all!"
In October 2017, Catalonia held an independence referendum that had been banned by Spain's central government. Several separatist leaders have been jailed or sought exile, and street protests continue.
The consequences of Thursday's ruling are unclear.
In a statement, the Spanish court said it would study "in depth the full content of the judgement of the ECJ" -- and added that it had given prosecutors and defence counsel five days to submit their views.
The Luxembourg-based court's ruling appears to invalidate the decision of the Spanish Supreme Court in July to prevent Junqueras from being freed from pre-trial detention.
But since then, in October, Junqueras was sentenced to 13 years in prison and disqualification from public office for sedition and embezzlement of public funds.
It is now up to the Spanish Supreme Court to decide on the appeal filed by the former Catalan vice-president's defence team. After the ruling, his party, the ERC, demanded "the nullity of the trial and his immediate release".
- 'Freedom for Junqueras!' -
The ECJ judgement also paves the way to the European Parliament for former Catalan regional president Carles Puigdemont and his health minister Toni Comin, who moved to Belgium to avoid legal proceedings in Spain.
Puigdemont and Comin were also elected to the European Parliament in May, but they were unable to take office because they did not travel to Madrid for the Spanish swearing-in ceremony.
"A person who is elected to the European Parliament acquires the status of Member of Parliament as a result of and from the time of the declaration of the election results," the ECJ ruled.
At a news conference in Brussels, Puigdemont said he hoped to take up his seat "as quickly as possible" and urged EU institutions to abandon their "complicit silence" and move to mediate the crisis.
Brussels has so far kept out of the Catalan issue, arguing that it is an internal matter for Spain.
Separately, a court in Spain ruled Thursday that Catalonia's president Quim Torra was unfit to hold public office for 18 months because he failed to remove separatist symbols from public buildings during an election campaign.
The ruling will only come into effect if it is confirmed by Spain's Supreme Court, which could take months, and it could trigger an early election in the wealthy northeastern region.
At the time of May's European parliamentary election, Junqueras was in pre-trial detention in Spain facing charges linked to his role in organising a banned Catalan independence referendum