The Gaddafi regime warned British officials that there would be "dire consequences" for relations between the UK and Libya if Lockerbie bomber Abdelbaset al-Megrahi died in his Scottish jail cell, it has emerged.
The extent of lobbying by the Libyan government leading up to Megrahi's release in August 2009 is laid bare in documents discovered by reporters in the abandoned British embassy building in Tripoli.
In one, seen by The Mail on Sunday, senior Foreign Office official Robert Dixon wrote to Foreign Secretary David Miliband in January 2009 that Muammar Gaddafi wanted Megrahi to return to Libya "at all costs".
"Libyan officials and ministers have warned of dire consequences for the UK-Libya relationship and UK commercial operations in Libya in the event of Megrahi's death in custody," he wrote.
He added: "We believe Libya might seek to exact vengeance."
Megrahi - the only person convicted of the 1988 Lockerbie bombing - was released on compassionate grounds after the Scottish government was told he had only three months to live. He is still alive today.
After a review of the paperwork in the case, Cabinet Secretary Sir Gus O'Donnell said in February that British ministers in the last Labour government believed Megrahi's release would be the "best outcome" as they feared that UK interests in Libya would be damaged if he was allowed to die in a Scottish jail.
Other documents discovered in Tripoli apparently indicated that MI5 traded information with their Libyan counterparts.
The Security Service provided intelligence on British-based Libyans opposed to the Gaddafi regime, according to The Sunday Times, which said it had seen an MI5 paper marked "UK/Libya eyes only secret".
In return, MI5 received updates on the disclosures of terrorist suspects under interrogation in Libyan prisons.
Among the finds is a letter that then prime minister Tony Blair wrote in 2007 to help Gaddafi's son Saif with his PhD thesis. It begins "Dear Engineer Saif" and is signed off "Best wishes, yours sincerely, Tony Blair".
The latest cache of documents follow others that were found in the Tripoli offices of former head of Libyan intelligence Musa Kusa, indicating the close cooperation between British intelligence and the former Gaddafi regime.
They contained communications between British and Libyan security ahead of Mr Blair's desert tent meeting with Gaddafi, when the then prime minister moved to thaw relations with the dictator in 2004.
Britain is said to have helped the Libyan dictator with his speech-writing.
The documents also show how the CIA worked with the Gaddafi regime on the rendition of terrorist suspects.
Foreign Secretary William Hague said he could not comment on security matters.
But he said: "On the subject of these apparent disclosures, first of all they relate to a period under the previous government so I have no knowledge of those, of what was happening behind the scenes at that time."
Meanwhile rebel forces in Libya have said they will lay siege to pro-Gaddafi cities until a deadline for their surrender expires on Saturday.
The head of the rebels' National Transitional Council, Mustafa Abdul-Jalil, told reporters that his military forces are supplying the cities of Sirte, Bani Walid, Jufra and Sabha with humanitarian aid but will keep up a siege until the towns surrender.
The comments come after the rebels extended to September 10 a deadline for those area to give up peacefully or face assault. The previous deadline was yesterday and some rebels had claimed they would advance on the cities at that time.
"We are by the grace of God in a position of strength, capable of entering any city, to deploy any of our fighters in any direction," Mr Abdul-Jalil said.
"However, in our desire to avoid bloodshed and to avoid more destruction to public properties and national institutions, we have given an ultimatum of one week to the areas of Sirte, Bani Walid, Jufra and Sabha."
Gaddafi remains a fugitive and there have been conflicting reports about his whereabouts.
Former Labour cabinet minister Alistair Darling dismissed the idea that the Brown government had secured Megrahi's release in response to Gaddafi's demands.
"There is no doubt that from our point of view we wanted to bring Gaddafi in from the cold because at the time we thought that was possible, and there is no doubt that Gaddafi wanted al-Megrahi out," he told BBC1's The Andrew Marr Show.
"However, all this hangs on the willingness of the British Labour government doing a deal with the Scottish Nationalist government, and anyone who knows anything about Scottish politics knows there is such a visceral dislike between the two the idea there was some kind of collaboration between the two just seems to be nonsense."