Several thousand people gathered in downtown Madrid on Sunday to protest a European court ruling that has led to the release of imprisoned Basque separatists convicted of terror attacks.

The Strasbourg-based European Court of Human Rights found that prisoners who had served time and completed sentence reduction programmes could not have their jail terms re-interpreted by Spain's judiciary.

The court's decision centred on the case of Ines del Rio Prada, who was sentenced in 1987 to a total of 3,828 years for multiple terror attacks carried out as a member of the armed Basque group Eta.

The attacks she took part in killed a total of 24 people.

Del Rio was due for release in 2008 but Spanish courts ruled her sentence reduction was applicable to her full sentence, and not the 30-year maximum term the law actually allows.

Del Rio has been freed since Tuesday's ruling, as has another Eta prisoner. The court's ruling cannot be appealed further.

"As a result of this ruling, I have to assume that Eta has achieved its objectives," said Alfonso Sanchez, 47, who was wounded in a 1985 Eta bomb blast.

"All I want is for the law to be enforced and respected, and that we should honour the memory and dignity of the victims."

Prime Minister Mariano Rajoy has called the European court's ruling the worst possible outcome because it will mean that about 100 other prisoners, including convicted terrorists and killers who fall into the same category as Del Rio, will have to be freed.

"I don't like this ruling one bit. I think it is unjust and wrong," Rajoy said.

Eta is considered a terrorist organisation by Spain, the US and the European Union.

It is blamed for the killings of more than 825 people in a campaign of bombings and shootings aimed at achieving an independent Basque state straddling Spain's border with France.