The European Parliament on Tuesday lifted the immunity of former Catalan leader Carles Puigdemont and two allies wanted by Spain following Catalonia's attempt to gain independence in 2017.

The MEPs, who have been in self-imposed exile, now risk being sent back to Spain to face trial and potentially imprisonment over the organisation of a banned separatist referendum in 2017.

The trio -- Puigdemont and former Catalan health and education ministers Clara Ponsati and Toni Comin -- immediately blamed the move on "political persecution" by Spain, which wants to try them for sedition.

The immunity of Puigdemont, the former regional president of Catalonia, was lifted by 400 votes to 248, while those of Comin and Ponsati were removed by 404 votes to 247, the parliament said.

Judicial authorities will now be able to consider extradition requests by Spain's supreme court, though in the meantime the trio can continue to perform their duties as MEPs.

Spanish Foreign Minister Arancha Gonzalez Laya said the vote proved that "the European Parliament cannot be used to shield parliamentarians from appearing in front of national courts" for a breach of national law.

The vote also showed "respect for the Spanish justice system" and ensured that disputes in Catalonia are solved in Spain and not at the EU level.

The three MEPs have already announced that they will take the case to the EU's highest court, the European Court of Justice.

Puigdemont, who has been living in Belgium to escape a Spanish arrest warrant, called the vote "a sad day for the European Parliament", saying it was "a clear case of political persecution".

"We have lost our immunity but the European Parliament has lost something more: European democracy," he added.

Comin is also in Belgium and subject to a European arrest warrant, while Ponsati worked as a university lecturer in Scotland and faces an extradition claim there.

In the Brussels press conference alongside Puigdemont and Comin, Ponsati said the vote was carried by an "Armada" of Spanish MEPs.

"But we will see in the future how strong they are," she said.

All three were elected as MEPs in 2019, meaning they enjoyed immunity from prosecution.

Last year, Madrid asked the parliament to strip them of that privilege, but a vote was delayed by the coronavirus crisis.

Fighting the extradition became a cause celebre among European politicians with similar regional claims, including in Scotland and Flanders in Belgium.

Spain accuses Puigdemont and Comin of sedition and embezzlement, and Ponsati of sedition.

The 2017 Catalan independence referendum stoked major tensions between the Spanish government and the leaders of the region of 7.5 million people, which includes Barcelona.

Support for independence has risen sharply over the past decade, but the bitterness of the debate has diminished since Socialist Prime Minister Pedro Sanchez came to power in Madrid in 2018.