In a victory for Catalan separatists, the EU’s top court ruled on Thursday that one of nine pro-independence leaders jailed in Spain is entitled to parliamentary immunity because he was elected as an MEP in May.

The Catalan Republican Left (ERC) party called for its leader, Oriol Junqueras, to be released from prison immediately after the European Court of Justice (ECJ) announced its decision. Mr Junqueras was sentenced in October to 13 years for sedition and misuse of misuse of public funds for his role in holding an unlawful independence referendum in 2017.

In a message posted on Mr Junqueras’ Twitter account, the former deputy president of Catalonia said the verdicts reached by Spain’s Supreme Court, which jailed eight other pro-independence figures for between 13 and nine years, should now be null and void.

“Justice has arrived from Europe. Our rights and those of 2,000,000 citizens who voted for us have been violated. Annul the sentence and freedom for all!” the tweet said.

Mr Junqueras and 11 others stood trial between February and June, with nine of the accused remaining in custody throughout the process.

In June, the Supreme Court refused to allow Mr Junqueras permission to leave prison to pick up his accreditation and swear an oath of office in Madrid before taking up his seat in the European Parliament.