The Lockerbie bomber, Abdelbaset al-Megrahi, was released from prison by the Scottish government today and flown out of the UK – to the fury of the Obama administration in the US.

Barack Obama, speaking on a talkshow, said the decision was a "mistake".

Megrahi left Greenock prison with a police escort and was taken to Glasgow international airport, where an Afriqiyah Airways jet took off for Tripoli just before 3.30pm.

The Scottish justice secretary, Kenny MacAskill, made the decision to release Megrahi, who has prostate cancer, on compassionate grounds.

The White House and the US state department criticised the decision, which they had vigorously opposed.

"The United States deeply regrets the decision," said the White House spokesman Robert Gibbs. "As we have expressed repeatedly to officials of the government of the United Kingdom and to Scottish authorities, we continue to believe that Megrahi should serve out his sentence in Scotland."

In Britain, the Tory leader, David Cameron, described Megrahi's release as "wrong and the product of some completely nonsensical thinking".

After the plane took off, a statement by Megrahi was released in which he maintained his innocence. "I am obviously very relieved to be leaving my prison cell at last and returning to Libya, my homeland," the statement 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.

"And 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."

In his announcement, MacAskill said medical opinion suggested the Libyan had three months to live. "Mr al-Megrahi did not show his victims any comfort or compassion. They were not allowed to return to the bosom of their families ... No compassion was shown by him to them, but that alone is not a reason for us to deny compassion to him and his family in his dying days. Our justice system demands that justice be imposed but compassion be available," he said.

Megrahi was told of the decision at 1pm. MacAskill emphasised he had made the decision alone and said it had been a heavy burden to bear.

He said he had consulted the families of victims and the US government. MacAskill said families could "not be expected to forget, let alone forgive. Their pain runs deep and the wounds remain. However, Mr al-Megrahi now faces a sentence imposed by a higher power. It's one that no court in any jurisdiction in any land can revoke or unroll. It's terminal, irrevocable and final – he's going to die."

Before confirming Megrahi's release, MacAskill said he had rejected an application by the Libyan government to send him back under a prisoner transfer agreement signed by the UK and Libya this year.

During his announcement, which lasted nearly 25 minutes, MacAskill said the US government and US families of the victims "had an expectation or were led to believe there would be no prisoner transfer and the sentence would be served in Scotland". He said it was "highly regrettable" the British government had not provided a clear explanation as to what was decided at the time of Megrahi's conviction.

The UK government had "failed to exclude" Scotland from the prisoner transfer agreement despite the fact that the only Libyan in Scottish custody was Megrahi, said MacAskill. He dashed hopes of a further inquiry into the bombings, as demanded by some relatives, saying it was "beyond the reach of Scottish law" but that the Scottish government would co-operate with any such inquiry.

Relatives on both sides of the Atlantic were told by officials that the announcement was timed to avoid US relatives waking up to discover Megrahi had been freed.

A number of them reacted angrily to the announcement. Kara Weipz, of Mt Laurel, New Jersey, whose 20-year-old brother Richard Monetti was killed, said: "I don't understand how the Scots can show compassion. It is an utter insult and utterly disgusting."

In contrast, many of the British victims' families supported Megrahi's release on compassionate grounds, some of them unconvinced that he was even partly responsible for Lockerbie.

The Rev John Mosey, whose daughter Helga, 19, died in the attack, said it was "right he should go home to die in dignity with his family".

Megrahi's wife said he was "happy" at the news. His mother, Hajja Fatma, 95, told the Tripoli Post she was "expecting him to enter [through her door] at any moment".

Scottish officials attempted to rebut allegations last night that a secret political deal had been struck to protect western oil interests in Libya and Muammar Gaddafi's international rehabilitation. A spokesman said: "We've a strong justice system in Scotland, and people can be assured that the justice secretary's decisions have been reached on the basis of clear evidence and on no other factors."