MADRID, Spain — Spain's Supreme Court upheld the acquittal of a top suspect in the 2004 Madrid commuter train bombings Thursday, rejecting an appeal by prosecutors partly on the grounds the man has already been convicted of the same crime in Italy.

Rabei Osman, an Egyptian, was one of three alleged masterminds cleared of mass murder in the bombings at a trial in Madrid in October. The long trial was a painful reminder to Spaniards of one of the blackest days in their country's history.

The court ruled Thursday that because Osman had already been sentenced to eight years in prison in Italy for association with a terror group, he could not be condemned again for the same crime, a court official told The Associated Press on condition of anonymity because of departmental rules. The court also upheld his acquittal on the mass murder charges, saying there was insufficient evidence.

Spanish prosecutors had argued unsuccessfully that Osman was appealing his Italian sentence, trying to leave the door open for a second trial here.

In Spain, both prosecutors and defendants can appeal lower court decisions.

Ten backpack bombs ripped through four packed rush hour commuter trains on the morning of March 11, 2004, killing 191 people and injuring more than 1,800 in Europe's worst Islamic terror attack.

A two-year Spanish investigation concluded that the killings had been carried out by homegrown radicals, inspired by al-Qaida's call to arms but with no direct link to Osama bin Laden's group.

Twenty-one people — including three masterminds — were convicted during the five-month trial that ended in October. Seven others, including Osman, were acquitted.

The Supreme Court also absolved four other men — Basel Ghalyoun, Mouhannad Almallah Dabas, Abdelilah el Fadual el Akil and Raul Gonzalez — who had all been convicted of lesser charges and sentenced to anywhere from five to 12 years.

The court slightly reduced the sentences of several others, and reversed the acquittal of Antonio Toro. The judges convicted him of exchanging explosives used in the attack for drugs and money, and sentenced him to four years.

Another convicted mastermind, Othman el Gnaoui, was cleared of the lesser charge of falsification, but would remain in jail on the more serious charges.

Deputy Prime Minister Maria Teresa Fernandez de la Vega did not comment on the court decision, but said the trial was a proud moment for Spain and showed the country's resilience in the face of the attacks.

"We are proud because Spaniards have given the world an example of efficiency, maturity and calmness in the face of the brutal blow the terrorist gave us," she said. "Our obligation is to look to the future with hope, always remembering the victims in our hearts."

Jesus Ramirez, a survivor of the attacks who until recently was vice president of a victims' association, said he accepted the judges' decision even if he did not agree with it.

"Even though we may oppose it in our hearts, they have more information and have weighed the evidence and made a decision," he told the AP.

The Supreme Court decision all but concludes the proceedings in the case. Appeals can be made to Spain's Constitutional Court, but only on limited ground where there are claims that the constitution has been violated.

Osman was arrested in Italy in June 2004 after allegedly saying in wiretapped conversations that the attacks were his idea. He repeatedly has denied it was his voice in the calls, and his Spanish defense lawyers also questioned the translation of the call used in the Italian court.

He was sent to Spain last year to attend the court proceedings, then returned to Italy to complete his sentence. Osman watched his October acquittal on closed circuit television from his Italian jail.

In Italy, Luca D'Auria, a lawyer who represented Osman in his Italian trial, was pleased with the ruling.

"Both myself and (Osman's) Spanish lawyer have always imagined it would end this way," D'Auria said Thursday. "I am extremely satisfied."