BRUSSELS -- Europe's top court ruled Thursday that a former vice-president of Spain's Catalonia region who is serving a prison sentence for launching a banned independence referendum has the right to parliamentary immunity.

The European Court of Justice ruling was seen as a major victory for the regional politicians behind the October 2017 secession referendum, many of whom are in prison or living in self-imposed exile as fugitives from Spanish justice.

The referendum in the relatively wealthy northeast region of 7.5 million people triggered Spain's most serious political crisis in decades.

In a separate ruling Thursday, a Catalan court held that the region's current president, Quim Torra, was unfit to hold office for 18 months for disobeying Spain's electoral board. The decision could lead to another regional election.

The Luxembourg-based European Union court found that former Catalan vice-president Oriol Junqueras earned the right to immunity when he was elected to the European Parliament in May.

The ECJ said that people like Junqueras who are elected as EU lawmakers "enjoy, from the moment the results are declared, the immunity" to travel to and take part in parliamentary sessions.

After the verdict, Junqueras, 50, tweeted: "Justice has come from Europe. Our rights and those of 2,000,000 citizens who voted for us have been violated. Annulment of the sentence and freedom for all! Persist as we have done!"

Junqueras was sentenced in October to 13 years in prison for sedition. Eleven of his associates were found guilty and eight of them also received prison terms.

He was in pretrial detention when he was declared to have won the European Parliament seat. But Spain's Supreme Court refused to allow him to leave prison to take an oath to respect the Spanish Constitution, a requirement for politicians to take up their seats as EU lawmakers

The Spanish electoral commission later declared Junqueras' seat vacant and suspended his parliamentary prerogatives.

However, the European court said that while Spanish law governs electoral procedures, EU law takes over once a person is elected to the European Parliament, which represents the 28 member nations and sits in Brussels and Strasbourg, France.

It's unclear whether the ECJ ruling might secure Junqueras' release.

Spain's Supreme Court said it would study the full ruling and gave prosecutors and defence lawyers five days to present their arguments, after which a decision will be made.

The case is likely to set an important precedent for fugitive former Catalan leader Carles Puigdemont, who was also elected to the EU parliament in May and has been living in exile in Belgium. Spain wants him extradited on charges of sedition and embezzlement.

Puigdemont is the subject of a Spanish arrest warrant over the independence referendum but he has also launched an appeal at the ECJ. A court in Brussels ruled earlier this week that it would await the outcome of his European case before deciding whether to extradite Puigdemont.

At his residence outside Brussels on Thursday, Puigdemont and former Catalan health minister Toni Comin cheered and applauded the verdict along with other regional politicians joining them by teleconference.

"If we can be at the European parliament, and we will be, it is because we were able to fight for our rights from an independent space, with legal guarantees, which is something that doesn't happen in the Spanish state," Puigdemont said.

Other members of the Catalan regional parliament who support Junqueras, greeted the ruling with shouts of "freedom."

The court verdict in Spain in the case against Torra came after overnight clashes between riot police and protesters during a soccer match between Barcelona and Real Madrid as authorities struggled to keep separatist activists from disrupting the game.

He was banned from holding office for disobeying Spain's electoral board by not removing secessionist symbols from public buildings in the northeastern region during an election campaign.

Torra, who is fervently in favour of independence and Catalonia's right to self-determination, told the court he did not believe the electoral board had the right to order him to remove the symbols.

Torra was also fined 30,000 euros ($33,0000). Spain's Constitution states that the country is indivisible.

The 2017 referendum on whether Catalonia should break away from Spain received an overwhelming "yes" vote amid a police crackdown. But those in favour of the northern region remaining part of Spain largely didn't cast ballots after Spain's central government declared the vote illegal.

Subsequent regional elections have indicated that Catalonia is evenly split between those in favour and those against independence, and the divisions are barely hidden.

------

Giles reported from Madrid. AP video reporter Mark Carlson in Brussels contributed to this report.