TRIPOLI, Libya - The only man convicted in the 1988 bombing of Pan Am Flight 103 over Lockerbie, Scotland, returned home yesterday to a cheering crowd tossing flower petals in the air after his release from a Scottish prison - an outrage to many relatives of the bombing's 270 victims.

President Obama said that Scotland's decision to free terminally ill Abdelbaset Ali Mohmed al-Megrahi on compassionate grounds was a mistake and that Megrahi should be under house arrest. Obama warned Libya not to give Megrahi a hero's welcome.

Despite the warning, thousands of young men were on hand at the military airport in Tripoli, where Megrahi's plane touched down. Dressed in a dark suit, he left the plane looking tired, accompanied by Libyan leader Moammar Gadhafi's son Saif al-Islam Gadhafi.

Saif Gadhafi, who pledged last year to bring Megrahi home, raised his hand victoriously to the crowd. The two men then sped off in a convoy of white sedans.

Megrahi's release disgusted many victims' relatives.

"This isn't about compassionate release," said Susan Cohen of Cape May Court House, N.J., who lost her daughter, Theodora, 20. "This is part of give-Gadhafi-what-he-wants-so-we-can-have-the-oil."

At home, Megrahi, 57, is seen as an innocent scapegoat whom the West used to turn Libya into a pariah. At the airport, some wore T-shirts with his picture and waved Libyan and miniature blue-and-white Scottish flags.

"It's a great day for us," Abdel-Aal Mansour, 24, said. "He belongs here, at home."

Moammar Gadhafi lobbied hard for Megrahi's return, an issue that took on added urgency when the convict was diagnosed with prostate cancer last year. He was recently given only months to live.

The former Libyan intelligence officer was convicted in 2001 of taking part in the Dec. 21, 1988, bombing and sentenced to life in prison. All 259 people aboard the New York-bound Pan Am jet and 11 on the ground were killed when it exploded and crashed into the town of Lockerbie.

Megrahi's conviction was largely based on the testimony of a Malta shopkeeper who identified him as having bought a man's shirt in his store. Scraps of the shirt were found wrapped around a timing device discovered in the wreckage of the jet. Critics of Megrahi's conviction question the reliability of the shopkeeper's evidence.

He was sentenced to serve a minimum of 27 years in a Scottish prison. But a 2007 review of his case found grounds for an appeal, and many in the United Kingdom believe he is innocent. He served eight years.

Scottish Justice Secretary Kenny MacAskill said that although Megrahi had not shown compassion to his victims - many of them American college students flying home for Christmas - MacAskill was motivated by Scottish values to show mercy.

"Those who have been bereaved cannot be expected to forget, let alone forgive," the secretary said. But Megrahi "now faces a sentence imposed by a higher power."

As Megrahi's white van rolled down a street outside Greenock Prison on his way to the airport in Glasgow, some men on the roadside made obscene gestures.

In a statement after his release, Megrahi stood by his insistence that he was wrongfully convicted.

"I say in the clearest possible terms, which I hope every person in every land will hear - all of this I have had to endure for something that I did not do," he said.

He also said: "To those victims' relatives who can bear to hear me say this, they continue to have my sincere sympathy for the unimaginable loss that they have suffered."

Gadhafi engineered a rapprochement with his former critics after the Sept. 11, 2001, attacks. He renounced terrorism, dismantled Libya's secret nuclear program, accepted his government's responsibility for the Lockerbie bombing, and paid compensation to the victims' families.

Western energy companies - including Britain's BP PLC - have moved into Libya in an effort to tap the country's vast oil and gas wealth.