The details, published in the Guardian, allege Libyan leader Colonel Gaddafi made "thuggish" threats to halt all trade deals if Megrahi stayed in jail.

Ministers insist the decision was based purely on the Scots justice system.

The Scottish government released Megrahi in August 2009 on compassionate grounds because he was diagnosed with terminal prostate cancer. He returned to Libya and is still alive.

The UK was "between a rock and a hard place" on the issue, one cable to Washington said.

The British ambassador in Libya allegedly told a US diplomat that the Libyans could "cut us off at the knees".

We weren't interested in threats, we weren't interested in blandishments, we were interested in Scots justiceAlex Salmond, First Minister of Scotland

The Guardian reported that the messages also showed Libya had offered "a parade of treats" to the Scottish administration if it agreed to let Megrahi go, though the cable confirmed they were turned down.

Scotland's First Minister Alex Salmond told BBC Radio 4's Today programme that the cables "vindicated" their position and everything they had said publicly and privately at the time.

"We weren't interested in threats, we weren't interested in blandishments, we were only interested in applying Scots justice and that's what we did," he said.

He added that no specific "treats" had been offered because they had "made clear to every interested party that we were not interested in any other matter".

The cables provide no "great new revelation" but merely a confirmation that the then UK government wanted Megrahi released, and that US diplomats were aware of that, he said.

Former UK justice secretary Jack Straw also said the revelations had no connection to the final decision.

"Both Alex Salmond and the British government have said until they're blue in the face what is true - that this was a decision which was made by the Scottish government, and by nobody else. And they did it on the basis of their law and their practice so far as the release of people in serious medical conditions on compassionate grounds."

'Enormous repercussions'

According to the leaked cables British diplomats had planned dramatic and pre-emptive measures preparing for hostile demonstrations and leaving only essential staff in the embassy, were Megrahi to die in prison.

The American charge d'affaires in London, Richard LeBaron, wrote a cable to Washington in October 2008.

Analysis

By Paul ReynoldsWorld affairs correspondent, BBC News website

The US cables add detail to the background to al-Mehrahi's release but do not change the fundamentals.

Critics of the deal will see in the threats made by the Libyan government further evidence that the British government backed down under pressure and somehow persuaded the Scottish government to fall into line.

However, it is no secret that London wanted the release and the memos stating this have previously been made public.

The issue is whether the Scottish government did the British bidding and here the released cables do not support that claim.

Indeed, nearly a year before the release, the Scottish First Minister Alex Salmond is quoted as saying that the decision would be taken on compassionate grounds, as it was. It is interesting that, at that stage, al-Megrahi's life expectancy with prostate cancer was as long as five years.

"The Libyans have told HMG [Her Majesty's Government] flat out that there will be 'enormous repercussions' for the UK-Libya bilateral relationship if Megrahi's early release is not handled properly," he said.

In January 2009 the US ambassador to Libya, Gene Cretz, confirmed that "dire" reprisals had been threatened against the UK, and the British were braced to take "dramatic" steps for self-protection.

The Libyans "convinced UK embassy officers that the consequences if Megrahi were to die in prison… would be harsh, immediate and not easily remedied… specific threats have included the immediate cessation of all UK commercial activity in Libya, a diminishment or severing of political ties, and demonstrations against official UK facilities".

Mr Cretz added: "[Libyan] officials also implied, but did not directly state, that the welfare of UK diplomats and citizens in Libya would be at risk."

The British ambassador in Tripoli, Vincent Fean, "expressed relief" when Megrahi was released, the US cables reported.

"He noted that a refusal of Megrahi's request could have had disastrous implications for British interests in Libya. 'They could have cut us off at the knees,' Fean bluntly said."

When Scottish Justice Secretary Kenny MacAskill announced the release, to a storm of protest, the US ambassador said the devolved government had got out of its depth.

"The Scottish government severely underestimated both US government and UK public reaction to its decision... Alex Salmond has privately indicated that he was 'shocked'," said the cable on 24 August.

Earlier a spokesman for Mr Salmond referred to the cables as "diplomatic tittle tattle from US diplomats."

"The cables confirm what we always said, that our only interest was taking a justice decision based on Scots law without fear or favour, which was exactly what was done, and that our public position was identical to our private one."

Details of the cables are the latest revelations on the whistle-blowing website Wikileaks to appear in the Guardian, along with several other newspapers around the world.

Meanwhile, the founder of Wikileaks, Julian Assange, has been refused bail by a court in London but vowed to fight extradition to Sweden.

Mr Assange denies sexually assaulting two women in Sweden. He was remanded in custody pending a hearing next week.