The pro-independence former leader of Catalonia, Carles Puigdemont, can run for election to the European Parliament this month, a Madrid court has ruled.
The ruling also applies to two other separatist Catalan politicians – Toni Comín and Clara Ponsatí.
All three fled Spain in 2017, when Madrid moved to thwart Catalonia’s independence bid and prosecuted them.
Ms Ponsatí is in Scotland; the others are in Belgium. Spain accuses them of “rebellion” and abuse of public funds.
Last month Spain’s central election commission, the JEC, had barred the three from appearing on the ballot, arguing that they were not residing in Spain.
The JEC decision followed a complaint from two Spanish parties opposed to Catalan independence: the conservative Popular Party (PP) and pro-business Ciudadanos.
However, the JEC also admitted that the charge of “rebellion” was not listed in the electoral law among possible reasons for barring a candidate from the European elections.
Under EU law, parliamentary immunity covers MEPs once they have been elected to the European Parliament and are exercising their duties.
But the clauses on immunity, in Protocol 7 of the EU Treaty on the Functioning of the EU, do not cover a candidate prior to his/her confirmation as an elected MEP.
So the Catalan candidates could still face arrest in Spain if they go home to campaign ahead of the 26 May election.
They also refuse to recognise the Spanish constitution, making it problematic for them to serve as Spanish MEPs.
Mr Puigdemont was in triumphant mood, in a tweet (in Catalan), saying “there is very good legal work behind each victory achieved”.
He and the other Catalan separatists are in the pro-independence coalition Junts per Catalunya (JuntsXCat). They aim to join a pan-European parliamentary group representing nationalists, called European Free Alliance (EFA).