A Catalan leader jailed for his role in an independence referendum deemed illegal by Spain was entitled to immunity as a member of the European parliament, despite not being able to take up his seat, the EU’s highest court has ruled.

The court of justice of the EU ruling on Thursday regarding Oriol Junqueras is a boost for the Catalan separatist movement and potentially puts judicial authorities in Brussels and Madrid at loggerheads.

Junqueras was jailed for 13 years in October after being convicted of sedition and misuse of public funds related to the region’s failed independence bid in autumn 2017, which Spanish authorities declared illegal.

He was elected to the European parliament in May despite having been in prison in Spain since November 2017.

Eight other leading figures in the independence movement were sentenced to jail terms along with Junqueras, and the bitter standoff between them and the government in Madrid has dominated Spain’s fragmented political landscape for more than two years.

A spokeswoman for the government said it had no immediate comment on the ruling.

The court said if Spanish authorities wanted to prevent Junqueras from travelling to the European parliament, they would have to request that it waived his immunity.

Immunity means an MEP cannot be subject to detention or legal proceedings because of views expressed or votes cast, although it does not apply to an MEP who has committed an offence.

Q&A What do the lengthy Catalan sentences mean? Show Despite the long sentences handed down by the supreme court on 14 October, some of the nine leaders convicted of sedition and misuse of public funds could soon be eligible to apply for “semi-liberty”, allowing them out of prison on a regular basis.

Josep María Tamarit, a professor of criminal law at the Open University of Catalonia, said that in cases where a sentence of five years or more was handed out, a court could stipulate “that half the sentence has to be served before prisoners are eligible for semi-liberty”. However, the supreme court turned down prosecutors’ request for such an order in the Catalan case. That means that Jordi Sànchez and Jordi Cuixart – who have now served two years in pre-trial detention – could apply to be allowed out on licence as soon as they have served a quarter of their sentences, which would be in January next year. Oriol Junqueras, who received the longest sentence – 13 years – would have to wait about 15 months before applying. Those convicted can complain to Spain’s constitutional court and then put their case before the European court of human rights in Strasbourg. The Spanish government has the power to issue pardons if they are requested and if the person convicted shows repentance for their crime. However, such a move would have profound political consequences. Opponents of Spain’s acting prime minister, the socialist leader Pedro Sánchez, would accused him of bowing before the separatists were his government to even consider a pardon. Sam Jones Photograph: Pau Barrena/AFP

The Catalan separatist party Esquerra Republicana de Catalunya (ERC), of which Junqueras is chairman, demanded his immediate release following the verdict.

“The [court] ... acknowledges that he had immunity,” the party wrote on Twitter. “We demand that the trial be voided and [his] immediate freedom.”

Also on Thursday, the leader of Catalonia’s regional government was found guilty of disobedience and sentenced to an 18-month ban on holding public office by the region’s highest court.

The sentence, which stems from Quim Torra’s refusal to follow orders from Spain’s electoral committee, is open to appeal, meaning the ban on holding office, if upheld, could take months to come into force.

The court also imposed a fine on Torra of about €30,000 (£25,000).