The Libyan convicted of the Lockerbie bombing today formally dropped the second appeal against his conviction for the attack which killed 270 people.
Terminally-ill Abdelbaset Ali Mohmed Al Megrahi is serving a life sentence after being convicted in 2001 of the 1988 atrocity.
Three judges at the High Court in Edinburgh today accepted his bid to formally drop his appeal amid growing speculation that he could be freed within days.
The court heard Megrahi's medical condition had worsened "very considerably" recently.
Scottish Justice Secretary Kenny MacAskill is deciding whether to release Megrahi, who is dying from prostate cancer, on compassionate grounds.
Today's successful bid by Megrahi's lawyers to drop his second appeal removed one possible obstacle to his returning to Libya by another mechanism - under a prisoner transfer agreement.
Scotland's top judge, the Lord Justice General Lord Hamilton, sitting with two other judges, was told Megrahi's condition was worsening and that he was anxious to spend what little time he has left with his family.
Defence QC, Margaret Scott, said: "The court is aware of Mr Megrahi's medical condition in that he has progressive prostate cancer.
"This has now reached the terminal stage and my client's condition has recently worsened very considerably.
"Up-to-date medical reports from three eminent experts also concurred in the view that he has a very aggressive cancer, that his condition is grave and that the prognosis is extremely limited."
Ms Scott also told the court her client believed dropping his appeal would speed up Mr MacAskill's decision on whether he should be freed or transferred to Libya.
She said the case met the guidelines for compassionate release and that "serious" health complications were "certain to arrive" in the very near future.
The lawyer said he was now very weak, suffering severe pain and was in distress.
She told the court: "His absolute priority in the little time he has left is to spend it with his family in his homeland."
Ms Scott added: "It's the appellant's belief that instructions to abandon his appeal will assist in the early determination of these applications."
The Libyan government applied in May for Megrahi to be transferred home to serve the rest of his sentence.
Last month, Megrahi put in a separate request to the Scottish Government to be released on compassionate grounds, a move which could have been granted even if the appeal was continuing.
Mr MacAskill has said he will announce his decision on the bomber's future by the end of the month.
The court heard that a separate appeal by the Crown against the length of Megrahi's sentence is still outstanding.
Lord Hamilton said it was "of the utmost importance" that the Lord Advocate Elish Angiolini makes an early decision on whether she intends to insist upon the appeal.
The judge said the court urged her to reach a decision on that matter without undue delay.
Megrahi was convicted of mass murder for the bombing of Pan Am flight 103 over Lockerbie, killing all 259 people onboard and 11 people in the Scottish town.
It was Britain's biggest terrorist atrocity.
After protracted international pressure, Megrahi and co-accused Al Amin Khalifa Fhimah were put on trial under Scots law at Camp Zeist in the Netherlands.
Megrahi was found guilty and ordered to serve a minimum of 27 years. Fhimah was found not guilty and freed.
Megrahi has already had one failed attempt to appeal his sentence, which he is currently serving at HMP Greenock.
When news of Megrahi's bid to drop his second appeal emerged last week, it prompted anger from relatives of victims because courtroom scrutiny of the case would not take place. Calls for a public inquiry were also renewed.
US Secretary of State Hillary Clinton entered the complex picture last week when she phoned Mr MacAskill to insist Megrahi serves out his jail term in Scotland.
Seven US senators, including Edward Kennedy and John Kerry, have also written a letter to Mr MacAskill urging him to keep Megrahi behind bars.
Megrahi lost his appeal in 2002 but was given a new chance to appeal against his conviction in 2007 when the Scottish Criminal Cases Review Commission referred his case back to senior judges for a second time.
Following a £1.1m three-year investigation into the case, the commission said there were grounds - some put forward by the defence, others arising from its own investigations - where it believed a miscarriage of justice may have occurred.
After many months of protracted procedural hearings, the appeal in full got under way in April - almost two years on from the commission's referral.
The Scottish Government made no comment on the outcome of the hearing.
A spokeswoman said: "This appeal has always been a matter for him, the courts, and his legal team."
Christine Grahame, a backbench SNP MSP who has visited Megrahi in prison, said outside court it was "extraordinary" that the Crown had not dropped its own appeal against Megrahi's sentence.
"The Crown was not prepared today to say whether they would drop their appeal." she said.
"We had the extraordinary thing of the Crown saying they'd not seen the medical evidence."
She went on: "They have known this was coming before the court and I hope that within the next 24 hours they lodge something dropping their appeal."
And she complained of "delay and confusion" on the part of the Crown Office.
She went on: "This man should now be granted compassionate release and it won't matter whether or not there are any proceedings pending.
"I have always said that, I have said the appeal should have proceeded.
"Unfortunately that won't happen now, but compassionate release is now the way forward and I hope there's an announcement later today from the Cabinet Secretary to that effect.
"Otherwise we have a man sitting in prison today extremely ill, very vexed, very anxious, very upset, and yet again the Crown Office has failed to get its act together."
A British relative, the Rev John Mosey, whose daughter Helga, 19, died in the bombing, said the outcome was "more or less what we expected".
He went on: "It's a sad day really.
"It's the worst possible decision for the families because we lose the opportunity to hear evidence that the Scottish Criminal Cases Review Commission thought was worth putting forward."
Mr Mosey said none of the big questions about Lockerbie had been answered.
"Who did it is still in the air - we thought that might have been answered at an appeal," he said.
But the "biggest question" was why the bombing was allowed to happen by western governments despite "at least 14 very significant and explicit warnings".
He said public comments by Mrs Clinton and US senators urging that Megrahi be kept in jail were intended for "local consumption" in the US.
"I think they will be very happy about the decision," he said.
"We are back where we started 21 years ago, asking for a wide-reaching independent inquiry into all aspects of this disaster."Reuse content