A Spanish judge has found 21 people guilty of involvement in the bombings of Madrid trains on 11 March 2004 which killed 191 people.
Seven of the accused were acquitted of any involvement in the bombings.
They included Rabei Osman Sayed Ahmed, known as 'Mohamed the Egyptian' who had been accused of master-minding the operation.
He is in prison in Italy after being convicted of belonging to an international terrorist group.
Moroccan Jamal Zougam was sentenced to a total of more than 40,000 years in prison, although under Spanish law he can only serve a maximum of 40 years.
Spaniard Emilio Suarez Trashorras, found guilty of supplying explosives, also received a sentence of thousands of years in jail.
A string of 10 bombs exploded on commuter trains on 11 March 2004.
A total of 191 people from 13 countries were killed and 1,841 others injured.
The early morning bombings on four packed commuter trains were one of the deadliest terrorist attacks in the West since the 11 September 2001 strikes against the US.
The announcement of the verdicts was carried live on Spanish television.
Dozens of armed police with bullet-proof vests surrounded the court, located at the entrance to a park in the west of the capital.
An armoured car with a machine gun was also parked outside the building.
The Spanish Prime Minister, José Luis Rodríguez Zapatero, said that 'justice was done'.