The Lockerbie bombing in 1988 killed 270 people
The UK has signed a prisoner transfer agreement with Libya, the Foreign Office has confirmed.
The agreement will allow the man convicted of the Lockerbie bombing to apply to serve the rest of his sentence in a Libyan jail.
Abdelbasset Ali al-Megrahi, 57, who has prostate cancer, is currently being held in Greenock prison in Scotland.
He has begun a second appeal against his conviction for the 1988 attack on Pan AM Flight 103.
The BBC's North Africa correspondent, Rana Jawad, said the package treaty encompasses four agreements, including prisoner transfer, extradition, mutual legal assistance, and civil and commercial law.
Any possible transfer to a Libyan prison would depend on Megrahi dropping his current appeal, which is expected to last a year.
And any transfer would have to be decided by Scottish ministers, who would have the final say.
There has been no comment from Megrahi's legal team about whether they are to apply for him to be transferred to a Libyan jail.
Megrahi's second appeal is being heard by five judges in Edinburgh, headed by Scotland's senior judge, the Lord Justice General, Lord Hamilton.
He has already lost one appeal against his conviction for the 1988 atrocity in which 270 people died.
Since then he has been in prison in Scotland, and must remain in jail until at least 2026.