Scottish Justice Secretary Kenny MacAskill announced his release on compassionate grounds at 1pm.

Megrahi is expected to fly home within hours to spend his dying days with his family.

It is understood he will be flown out of Glasgow Airport. Reports say a plane which will take Megrahi back has left the Libyan capital Tripoli.

The decision to set him free is likely to cause outrage in the United States, where secretary of state Hillary Clinton said she hoped he would stay behind bars.

Mr MacAskill made the announcement at the Scottish Government's ministerial headquarters in Edinburgh.

He had been considering two applications - one for Megrahi to be moved from Greenock prison to Libya under a prisoner transfer agreement, and a separate application for him to be released early on compassionate grounds.