A Spanish court found 21 people guilty of involvement in the 2004 Madrid train bombings but cleared three men of masterminding Europe's deadliest Islamist attack, which killed 191 people.

Victims were shocked by the sentences, which in many cases were much lower than the state attorney had requested and left them without any clearer idea of who dreamed up the attack that ripped apart four commuter trains like tin cans.

Judge Javier Gomez Bermudez sentenced three men -- two Moroccans and a Spaniard who provided the bombers with explosives -- to as many as 42,924 years in prison but nobody else got more than 23 years and seven people were acquitted.

Under Spanish law nobody can serve more than 40 years in jail.

"The sentences seem very soft and wishy-washy considering the atrocity they committed," said Carlos Jeria, a Chilean whose son-in-law was killed in the attack.

The biggest surprise was that two men originally accused of planning the attack were convicted only of belonging to a terrorist group, not of the Madrid killings.

A third suspected mastermind Rabei Osman Sayed Ahmed or "Mohamed the Egyptian" was cleared of all charges. He is already in jail in Italy for belonging to a terrorist group.

"We're very surprised by the acquittal. If it wasn't them, we have to find out who it was. Somebody gave the order," said Jose Maria de Pablos, spokesman for a victims' association.

Ten bombs packed into sports bags and detonated by mobile phones tore through the trains on March 11, 2004, strewing the tracks with bodies and injuring more than 1,800 people.

Three weeks later, seven men including two suspected ringleaders of the train bombings blew themselves up in a suburban apartment after police closed in on them. The explosives were the same as were used in the March 11 attack.

They may have taken with them the main evidence of who was behind the attack, which the magistrate who investigated the bombings said was inspired by, but not directed by, al Qaeda.

THREE MAIN CONVICTS

The court laid most of the charges at the feet of the three men sentenced to thousands of years in prison.

Jamal Zougam was found guilty of belonging to a jihadist terrorist cell and convicted of terrorist murder. He was seen by three witnesses on the trains that blew up.

Fellow Moroccan Othman el Gnaoui was convicted of the same charges and found guilty of helping to get explosives to a house near Madrid where the bombs were prepared. Spaniard Jose Emilio Suarez Trashorras was found guilty of providing the explosives in the knowledge they could be used for a terrorist attack.

At the sentences were handed out, the three men sat silently behind bullet-proof glass staring at the judge or the floor.

As he summed up the trial, Judge Gomez Bermudez again said there was no proof Basque separatist rebels ETA had anything to do with the train bombs, despite some media and victims' support groups still insisting there must be some link to them.

The conservative government in power in March 2004 at first pinned the attack on ETA but as more evidence piled up to show it was the work of an Islamist cell, Spain turned against its leaders and voted them out of power three days later.

(Additional reporting by Anna Valderrama, Teresa Larraz, Ben Harding and Raquel Castillo)