The former Labour government did "all it could" to release the Lockerbie bomber, according to Cabinet Secretary, Sir Gus O'Donnell.
Sir Gus was instructed to conduct a review by David Cameron after promising US President Barack Obama complete disclosure on the matter.
The review concluded that a policy was progressively developed to facilitate the Libyans in their appeal to the Scottish government for the release of Abdelbaset al-Megrahi on compassionate grounds.
In his report, Sir Gus said the documents inspected showed that the government had made it clear that any decision to release Megrahi, or transfer him to Libya, was a matter for the Scottish government alone.
"Nonetheless, once Mr Megrahi had been diagnosed with terminal cancer in September 2008, HMG policy was based upon an assessment that UK interests would be damaged if Mr Megrahi were to die in a UK jail," Sir Gus said.
"The development of this view was prompted, following Mr Megrahi's diagnosis of terminal illness, by the extremely high priority attached to Mr Megrahi's return by the Libyans, who had made clear that they would regard his death in Scottish custody as a death sentence and by actual and implicit threats made of severe ramifications for UK interests if Mr Megrahi were to die in prison in Scotland." he added.
Sir Gus said the government had been "primarily motivated by a desire to build on previous success in normalising relations with Libya and to safeguard the substantial gains made in recent years, and specifically to avoid harm to UK nationals, to British commercial interests and to co-operation on security issues".
He added: "The desire to see such a result developed and intensified over time as Mr Megrahi's health declined and the imminence of his death appeared greater."
The UK reportedly dropped efforts to exclude Megrahi from the deal after Libya used a multibillion-pound oil deal with BP as a bargaining chip.
Sir Gus confirmed that oil giant BP had lobbied the UK government, warning ministers that failure to reach a PTA, which enabled Megrahi's return, could have an impact on British commercial interests.
But he said there was no evidence that BP tried to pressurise the Scottish government to release Megrahi under the PTA once it was in place.