The British government feared that Libya would take “harsh and immediate action” against its interests if the Lockerbie bomber died in prison, according to leaked US diplomatic cables.

Libyan leader Muammar Gaddafi made “thuggish” threats to halt all trade deals with the UK and harass embassy staff if Abdelbaset al-Megrahi was not freed. Tripoli also offered a “parade of treats” to the Scottish devolved administration if it let the convicted mass killer go — although the incentives were refused.

Details of the fraught contacts between Libya and Britain over al-Megrahi are revealed in documents obtained by controversial website WikiLeaks and seen by the Guardian.

The American charge d'affaires in London, Richard LeBaron, wrote in a cable to his bosses 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.”

The cable said the US embassy had been given this information by two British officials — Downing Street's North Africa advisor Ben Lyons, and Rob Dixon, his counterpart at the Foreign Office.

The Scottish government eventually released al-Megrahi on compassionate grounds in August last year because he was suffering from terminal prostate cancer.

However, the move caused fury in the US amid suggestions that it was linked to lucrative British oil deals with Libya.

Al-Megrahi received a hero's welcome on his return to the country and is still alive more than a year later.

Since becoming Prime Minister David Cameron has condemned the decision to free al-Megrahi as “completely wrong”.

In January 2009, the US ambassador to Libya, Gene Cretz, |confirmed in a cable that “dire” reprisals had been threatened against the UK and London was braced to take “dramatic” steps for self-protection. The Libyans threatened “harsh”, and “immediate” action against UK interests.