Libyan Minister for Europe Abdulati Ibrahim al Obidi is quoted in minutes just released by the Scottish Government on the decision-making process which led to allowing Abdelbaset Ali Mohmed al Megrahi to return home.

At a meeting attended by Mr al Obidi and Scottish Government justice officials in Glasgow in March this year, Mr al Obidi briefed them on a meeting he had with Foreign Office minister Bill Rammell in February when a prisoner transfer agreement was discussed.

The report says: “Mr al Obidi confirmed that he had reiterated to Mr Rammell that the death of Mr Megrahi in a Scottish prison would have catastrophic effects for the relationship between Libya and the UK.

“Mr Alobidi went on to say that Mr Rammell had stated that neither the Prime Minister nor the Foreign Secretary would want Mr Megrahi to pass away in prison but the decision lies in the hands of the Scottish ministers.”

Westminster’s Justice Secretary Jack Straw told the Scottish Government it would not be “necessary or sensible” to risk damaging the UK’s relations with Libya by excluding the man accused of the Lockerbie bombing from a prisoner transfer agreement, according to letters just released.

Mr Straw had initially agreed to a Scottish request for Megrahi to be excluded from the agreement, and assured his counterpart in Edinburgh, Kenny MacAskill, in September 2007 that UK diplomats would tell the Libyan authorities no agreement was possible without this condition.

But just weeks later, in December 2007, the Mr Straw admitted he had not been able to secure an exemption for Megrahi and had decided to go ahead with the agreement “in view of the overwhelming interests of the United Kingdom”.

He later wrote to Scottish First Minister Alex Salmond in February 2008, assuring him: “No prisoner can be transferred under the PTA without the consent of both countries and any decision concerning the transfer of a prisoner from Scottish jail would be a matter for Scottish ministers.

“Given these safeguards, I do not believe that it is necessary or sensible to risk damaging our wide-ranging and beneficial relationship with Libya by inserting a specific inclusion into the PTA.”

Mr Straw wrote to Mr Salmond in November last year pointing out Libyan “concerns for health and possible return to Libya” of Megrahi but stressed it was a matter for the Scottish administration to decide.

In a letter of August 3 this year, Foreign Office minister Ivan Lewis wrote to Mr MacAskill to say he hoped he would feel able to consider Megrahi’s application for a return to Libya under the terms of the agreement.

But in the event, the man found guilty of downing PanAm flight 103 in 1988, killing 270, was allowed to return home on compassionate grounds because of his terminal cancer. The prisoner transfer arrangements were not used in his release on August 20, which caused controversy in Britain and the US, where most of the victims lived.

Some details relating to the US Government’s views on Megrahi’s application for release have been cut from the Foreign Office documents, as have the identities of civil service officials.

In a statement published on its website alongside the letters, the Foreign Office said it had “provided an authoritative view that there was no international legal bar to transfer should the Scottish Government decide to approve a request”.

One letter revealed that the Scottish authorities sought assurances over whether the UK had given any commitments to the US Government or the United Nations prior to Megrahi’s surrender for trial in 1999 which could stand in the way of his eventual release.

A Foreign Office official -- whose name was edited out of the release -- responded that no such commitment was given.

“The Government of the day, in conjunction with the then Lord Advocate, was keen to ensure that any political assurances given to the US would not bind the hands of successor governments,” said the official in a letter to the deputy director of the Scottish Government Criminal Justice Directorate, George Burgess, on July 3 this year.

“We could not at the time rule out the possibility that our relations with Libya might one day change. The UK Government consequently did not give the US an absolute commitment in relation to the future imprisonment of the Lockerbie accused.

“While it was absolutely right that the Lockerbie accused was brought to trial in a Scottish court and imprisoned in Scotland in accordance with Scots law, we do not consider that the UK entered into a definitive commitment, legal or otherwise, that now precludes Megrahi’s transfer under the Prisoner Transfer Agreement, should Scottish ministers decide to approve that request.”

The official asked Mr Burgess to keep the contents of his letter secret as “the complex negotiations to secure the surrender for trial of the Lockerbie accused were extremely sensitive and continue to be so”.

The Scottish Government later published a number of documents on its website.

They included notes of a meeting between Mr MacAskill and Megrahi at Greenock prison and advice from Scottish officials on the prisoner transfer agreement.

Minutes of a meeting between Libyan and Scottish officials on prisoner transfer noted concerns that the prisoner could be returned to a “fanfare” in Libya.

Details of a meeting with families of Lockerbie bombing victims are also included.

Also included was a handwritten letter from Megrahi to Mr MacAskill in which he said: “I am unjustly convicted of a most heinous crime.”

The letter told of Megrahi’s “sense of desolation”.