(CNN) -- Leaked U.S. diplomatic cables showed growing anxiety in the British government over threats from the Libyan leader, Moammar Gadhafi, should the convicted Lockerbie bomber Abdelbeset al-Megrahi die in a Scottish prison.
By late 2008, al-Megrahi's health was declining. Diagnosed with prostate cancer, he had been given months to live.
And it had become a badge of pride for the Libyans to bring him home.
A cable from the U.S. embassy in Tripoli, the Libyan capital, in January 2009 says: "The U.K. Embassy expects a sharply negative GOL (Libyan) reaction if al-Megrahi dies in prison or if the Scottish Executive and/or FCO oppose his transfer," referring to Scotland's government and the British Foreign Office in London.
Al-Megrahi is the only person ever convicted in connection with the bombing of Pan Am flight 103 over Scotland in 1988, which killed 270 people.
The diplomat's message is one of several cables obtained by WikiLeaks on the al-Megrahi case.
Quoting the British ambassador, the cable goes on: "Threats included commercial sanctions, severing of political ties and suggestions that the welfare of British diplomats and citizens would be at risk."
And the U.S. ambassador, Gene A. Kretz, said American interests might face similar retribution.
Scottish authorities declassified a huge trove of documents related to the case in September 2009, shortly after al-Megrahi was released. They paint a similar picture of Libyan threats, often not very thinly veiled, to secure the Libyan's freedom.
A senior Libyan source, responding to the leaks U.S. cables, told CNN that Libyans were shocked by the ignorance of American diplomats.
"They are not honest in the information they are sending back to Washington," he said. "They use gossip and rumor as sources of information.
"Americans have an image of Libya. So rather than learning about the country they just want to fit the image," the source said.
The British government was negotiating a Prisoner Transfer Agreement with Libya at the time of the American cables, but was concerned it would not be completed in time for al-Megrahi to be sent home to Libya before he died.
The January 2009 cable warned that the Libyan "regime remains essentially thuggish in its approach."
It continues: "The over-reaction of Muammar al-Qadhafi to what amounted to a matter of pride involving a verbal spat with then-Crown Prince Abdullah at the 2003 Arab League Summit, together with the more recent deterioration of Swiss-Libyan ties, are illustrative of what may happen should al-Megrahi die in prison."
At the time Libya and Switzerland were involved in a diplomatic spat over the arrest of one of Gadhafi's sons in Switzerland, accused of assaulting his servants in a Geneva hotel. No charges were filed.
The pressure on Britain mounted through 2009. In August, another cable from the U.S. embassy in Tripoli said the Libyan foreign minister had promised there would be no celebrations should al-Megrahi return, as he was "too ill for anything but a quiet return to his family."
The U.S. mission quoted the British ambassador as saying that a refusal to repatriate al-Megrahi could have disastrous implications for British interests in Libya.
"They could have cut us off at the knees, just like the Swiss," he is quoted as saying.
The Libyans were also infuriated by the U.S. government's position, that al-Megrahi should not be released and should finish his life sentence in jail in Scotland.
One senior Libyan official described "the U.S. justice system as infamous for making mistakes and jailing innocent people," according to one cable.
The same official would offer no guarantees that al-Megrahi's return would be subdued.
"No one can object to Libyans expressing their feelings if Megrahi comes back," he said. "This is democracy."
Just a few days later, on August 20 2009, al-Megrahi was freed on compassionate grounds. At the time, Scottish officials said the medical advice was that al-Megrahi would live about three months.
Another of Gaddafi's sons, Saif al-Islam Gadhafi, flew in a private jet to Scotland to bring him home. Libyan television broadcast celebrations from Tripoli airport when the plane arrived.
Al-Megrahi is still alive more than a year after his release, and the story has continued to overshadow relations between Britain and Libya.
A leaked American cable from February this year covered a conversation between a U.S. diplomat and the North Africa director at the British Foreign Office, who "explained that fear over how Tripoli will handle Megrahi's eventual funeral remains a major concern and one that (the British government) continues to raise regularly."
"Summing up the relationship, she described it as being 'in limbo' and 'lacking clarity' on several fronts," the cable says.
CNN's Zain Verjee contributed to this report.