A CATALAN politician jailed for 13 years for his role in the 2017 independence referendum should have the right to parliamentary immunity as a MEP, Europe’s top court has ruled.

The European Court of Justice (ECJ) found that Oriol Junqueras, who was Catalonia’s vice-president at the time of the vote – which Spain declared illegal – had a right to immunity because he was elected to the European Parliament in May – five months before he was found guilty of sedition and sentenced.

It said people like Junqueras who are elected as EU parliamentarians “enjoy, from the moment the results are declared, the immunity” to travel to and take part in parliamentary sessions.

He was already in pre-trial detention when he was declared to have won the European Parliament seat.

Spain's Supreme Court refused to allow him to leave prison to take an oath to respect the Spanish constitution, a requirement the country places on politicians before they can take up their seats as MEPs.

READ MORE: Catalan president in court over 'partisan' yellow ribbons

The Spanish electoral commission later ruled that his seat was vacant and suspended his parliamentary prerogatives.

Although it is unclear what the court's ruling could mean for Junqueras' future, it could set a precedent for former Catalan president Carles Puigdemont, who is in exile in Belgium and who was also elected to the European Parliament in May.

A Brussels court ruled earlier this week that it would await the outcome of his European case before deciding whether to extradite Puigdemont under a European Arrest Warrant (EAW) issued by Spain.

Scots lawyer Aamer Anwar, who has been fighting a EAW for former Catalan education minister Clara Ponsati, tweeted: “Huge defeat for Spain as ECJ rules their actions unlawful in blocking political prisoner Vice President @junqueras from becoming MEP which gives him immunity - decision would apply also to exiled president @KRLS [Puigdemont] & minister @toni_comin.”