The Spanish government has formally pardoned nine Catalan separatists who were convicted over a failed independence bid in 2017.

The leaders were imprisoned after being found guilty of sedition in 2019.

Three others were convicted of disobedience but not jailed at the same time.

The pardons have sparked controversy in Spain and tens of thousands protested against the decision this month.

But the government argues the move will help calm tensions over Catalonia.

The semi-autonomous region’s drive for independence almost four years ago plunged Spain into its biggest political crisis in 40 years.

Prime Minister Pedro Sanchez said the decision did not overturn the prisoners’ ban on holding office and was conditional on them not committing any other crimes within a certain period of time

He said the government did not require those pardoned to abandon their political ideas, underlining that they had been convicted for their actions and not their beliefs.

One of the nine who were imprisoned, Catalonia’s former foreign minister Raül Romeva, remained defiant.

The ruling separatists in the Catalan parliament declared independence in October 2017, after a referendum which the Spanish Constitutional Court declared illegal.

The Spanish government maintains that Catalonia had no constitutional right to break away, and temporarily imposed direct rule on the region after the government in Barcelona declared independence.

A number of Catalan officials, including the region’s leader Carles Puigdemont, fled abroad.

But others who remained in Spain were put on trial and nine separatists were given prison sentences over their role in the independence attempt in 2019.