A jailed Catalan separatist leader should have been given immunity to take office in the European Parliament, the EU’s top court ruled on Thursday.
Oriol Junqueras should have had legal immunity from the moment that results were declared of the May elections even though he was on trial for sedition in Spain
The European Court of Justice (ECJ) said that Spain should have released him from prison to allow him to take office.
The judgement also appears to clear the way for two Catalan leaders who sought refuge in Belgium to take up their seats in the European parliament.
Mr Junqueras was convicted and jailed for 13 years after the result over his role in staging an illegal referendum on Catalan independence in 2017. Eight other separatists received jail terms.
He won a seat in the European parliament 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.
Once elected, Mr 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.
On Twitter, Mr 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!"
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".
It said 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.
The ruling clears the way for former Catalan regional president Carles Puigdemont and his health minister Toni Comin to take up their seats. They moved to Belgium to avoid legal proceedings in Spain.
Mr Puigdemont tweeted: "There are still judges in Europe. Immediate freedom for Junqueras!"
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.
Street protests triggered by the jailing of the separatist leaders continue.