Megrahi case led to threats against UK's Libyan interests, while Scots who released him had turned down 'a parade of treats'

The British government's deep fears that Libya would take "harsh and immediate" action against UK interests if the convicted Lockerbie bomber died in a Scottish prison are revealed in secret US embassy cables which show London's full support for the early release of Abdelbaset al-Megrahi.

Muammar Gaddafi, the Libyan leader, made explicit and "thuggish" threats to halt all trade deals with Britain and harass embassy staff if Megrahi remained in jail, the cables show. At the same time "a parade of treats" was offered by Libya to the Scottish devolved administration if it agreed to let him go, though the cable says they were turned down.

Britain at the time was "in an awkward position" and "between a rock and a hard place". The London charge d'affaires, Richard LeBaron, wrote in a cable to Washington in October 2008. "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."

This intelligence, the cable said, was confided to the US embassy by two British officials: Ben Lyons, in charge of north Africa for Downing Street, and Rob Dixon, his counterpart at the Foreign Office.

Details of the Megrahi manoeuvrings come in the latest batch of leaked US dispatches which also detail:

• Deep distrust of Gaddafi among other African leaders; Ugandan president Yoweri Museveni, for example, feared a Libyan attack on his aircraft.

• Gaddafi's many eccentricities, including phobias about flying over water and staying above ground floor level.

• Saudi calls for an Arab-led force, backed by US air and sea power, to fight Iranian-backed Hezbollah in Lebanon.

The Megrahi cables may do much to explain why he was released in August 2009, supposedly because he was on the brink of death from prostate cancer. The decision incurred American wrath. More than a year on Megrahi is still alive, having been feted when he was escorted back to Tripoli by Gaddafi's son.

Public congressional hearings in September were told by a US prostate specialist that the official reason for the compassionate release – that Megrahi was within three months of death – was "ridiculous".

Anger with the British persists in some American circles, and UK ministers, Labour and Tory, have attempted to distance London from the release insisting it was purely a Scottish decision.

In January 2009, six months before Megrahi's release, 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.

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

Cretz cabled that "the regime remains essentially thuggish in its approach". He warned the US itself should keep quiet: "If the [US government] publicly opposes al-Megrahi's release or is perceived to be complicit in a decision to keep al-Megrahi in prison, [America's Libyan diplomatic] post judges that US interests could face similar consequences."

In the light of the repeated, politically unacceptable demands for Megrahi's release from Gaddafi, the illness at first seemed providential for Britain.

The cables reveal how the Scottish Nationalist first minister of Scotland, Alex Salmond, was edged into taking the political heat for releasing Megrahi, who had been diagnosed with cancer in September 2008. The message US diplomats received from Jack Straw, then justice minister, was that although Megrahi might survive up to five years, Labour's rivals in Scotland – Salmond and his SNP – were nonetheless inclined to release him.

A cable said: "Megrahi could have as long as five years to live but the average life expectancy of someone of his age with his condition is 18 months to two years. Doctors are not sure where he is on the time scale."The Libyans have not yet made a formal application for compassionate release … but HMG believes that the Scottish may be inclined to grant the request, when it comes, based on conversations between … Alex Salmond and UK justice secretary Jack Straw. Although the general practice is to grant compassionate release within three months of end of life, this is not codified in the law, so the release, if granted, could occur sooner."

The American diplomats were worried "Salmond and the SNP will look for opportunities to exploit the Megrahi case for their own advantage". But when the Scottish justice minister finally announced a "compassionate release" to a storm of protest the following August, the US ambassador said the Scots had got out of their 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'."

Salmond had told the US consul in Edinburgh on 21 August that "he and his government had played straight with both the US and the UK government, but implied the UK had not … he said the Libyan government had offered the Scottish government a parade of treats, 'all of which were turned down'."

Three days later Robin Naysmith, who served as the SNP's representative in Washington, said Salmond was shocked by the US outcry. "Naysmith underscored that Scotland received 'nothing' for releasing Megrahi, while the UK government has gotten everything – a chance to stick it to Salmond's SNP and good relations with Libya."

SNP "comments were designed to blame the UK government for putting the Scots in a position to have to make a decision", according to civil servant Rob Dixon, talking to the Americans.

Washington's ambassador to London, Louis Susman, observed unsympathetically: "It is clear that the Scottish government underestimated the blowback it would receive in response to Megrahi's release and is now trying to paint itself as the victim."

US officials were suspicious, going so far as privately to accuse the wealthy Gulf state of Qatar of bribing the Scots by dangling the possibility of Middle East loans.

In October 2009 the US ambassador in Doha confronted Khalid al-Attiyah, a Qatari minister who had lobbied SNP politicians at the time.

The US had "strong objections" to what had happened, he said. "The ambassador raised strong US government concerns about Qatar's role in the release … Al-Attiyah explained the Arab League had asked Qatar, in its capacity as the current chair … to seek Megrahi's release on humanitarian grounds; second, Megrahi had sent a personal letter to [the Qatar ruler] pleading for humanitarian intervention.

"On the basis of these two factors … he was dispatched to Scotland to meet the minister of justice there.

"Ambassador pressed the issue of whether Qatar had offered any financial or trade incentives to induce al-Megrahi's release. Al-Attiyah strongly dismissed such speculation, saying: 'That is ridiculous. It was not necessary to offer money. It was all done within Scottish law. We offered no money, investment, or payment of any kind.'"

The other object of US suspicion was Tony Blair's 2007 visit to Libya as British prime minister. The trip was linked to oil and gas. The US embassy in Tripoli noted on 23 August 2009: "Rumours that Blair made linkages between Megrahi's release and trade deals have been longstanding among embassy contacts … the UK ambassador in Tripoli categorically denied the claims."In February this year UK diplomats told the US they were fretting about the prospect of an eventual hero's funeral for Megrahi. The new Foreign Office north Africa director, Philippa Saunders, "explained that fear over how Tripoli will handle Megrahi's eventual funeral remains a major concern".

She added: "The UK embassy is currently engaged in an effort to identify all possible UK 'levers of influence' with Tripoli. Unfortunately 'there aren't too many', although she mentioned Tony Blair and a private doctor who had a personal relationship with the Gaddafi family.

"There will be maybe a 48-hour window if we're lucky between Megrahi's eventual death and a funeral."

Salmond's spokesman said last night that the leaks were "diplomatic tittle tattle", but "vindicated" the Scottish government's position.

He said: "We were clearly the only ones playing with a straight bat and interested in applying the precepts of Scottish justice, which we continue to do and continue to uphold.

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

"They also show that the former UK government were playing false on the issue, with a different public position from their private one - which must be deeply embarrassing for the Labour Party in Scotland - and that the US government was fully aware of the pressure being applied to the UK government."