Megrahi, 60, was sentenced to life in prison for the 1988 bombing of a US airliner which claimed 270 lives. It was Britain's biggest terrorist atrocity.
The bombing of the plane, travelling from London to New York four days before Christmas, killed all 259 people on board. Eleven residents of the Dumfries and Galloway town also died after the plane crashed down on their homes.
After protracted international pressure, Megrahi was put on trial under Scots law at Camp Zeist in the Netherlands. He was found guilty in 2001 of mass murder and was ordered to serve a minimum of 27 years behind bars.
Despite claims that he could not have worked alone, and the lingering suspicion by many that he was innocent, Megrahi was the only man ever convicted over the terrorist attack.
He was freed from prison after serving nearly eight years of his sentence after he dropped his second appeal against conviction at the Court of Criminal Appeal in Edinburgh.
His son, Khaled, confirmed that he died in Tripoli. Saad Nasser al-Megrahi, another relative and a member of the ruling National Transitional Council, said Megrahi's health had seriously deteriorated in recent days and he died of cancer-related complications.
Megrahi died at his Tripoli home this morning, according to another NTC member, Moussa al-Kouni.
Recent reports suggested his prostate cancer had spread to his neck. Others said he had been kept alive with cancer drugs unavailable in the UK.
Consultant urologist professor Roger Kirby, founder and director of The Prostate Centre in London, said he believed that abiraterone was likely to have been responsible for Megrahi's prolonged life well beyond the three-month point.
Last month Megrahi was reported to have been admitted to hospital for a blood transfusion.
Scottish Justice Secretary Kenny MacAskill's decision to allow Megrahi to return home to die in Libya sparked international condemnation from some relatives of victims and politicians, who demanded he be returned to jail.
US families were among the most vocal critics of the decision, along with US president Barack Obama. US secretary of state Hillary Clinton branded the move "absolutely wrong". American fury at the decision was compounded by the hero's welcome Megrahi received in Tripoli upon his return.
Prime Minister David Cameron has also come under pressure from some US senators for an independent inquiry into the decision to free the bomber. However, the move also attracted support from some victims' relatives in Britain, and high profile figures such as Nelson Mandela and Archbishop Desmond Tutu.
In August 2009, Mr MacAskill's said the decision to allow Megrahi to return home to die was based on a medical report provided to him by Dr Andrew Fraser, the director of health and social care at the Scottish Prison Service.
His report described the three-month prognosis as "reasonable" but stated that no-one "would be willing to say" if Megrahi would live longer.
The death comes two years and nine months after his release from Greenock prison. Scottish ministers have always insisted that their decision was made in good faith, on compassionate grounds alone and followed the due process of Scots law.
But those who opposed the decision insisted Megrahi should not have been freed.
With each anniversary connected to Megrahi's controversial release, calls were repeated for an apology from the Scottish Government and for more evidence to back up the decision.
Megrahi had rarely been seen since his return to Tripoli, but he was spotted on Libyan television at what appeared to be a pro-government rally in July.
UK Foreign Secretary William Hague said the public appearance confirmed that a "great mistake" was made in releasing him from jail.
He protested his innocence to the end. During his time in jail in the UK, Megrahi fought against his conviction.
He lost an appeal in 2002 but was given the chance to launch a second legal battle in 2007 when the Scottish Criminal Cases Review Commission (SCCRC) referred his case back to senior judges.
Following a £1.1 million, three-year investigation into the case, the commission said there were grounds where it believed a miscarriage of justice may have occurred.
The appeal in full got under way in April 2009, almost two years on from the SCCRC's referral, but was dropped by the Libyan two days before he was released.
The SCCRC's report, which raised questions about identification evidence that led to Megrahi's conviction, has not officially been made public, but the Scottish Government has pledged to bring about a change in the law to allow the paperwork to be seen.
The 800-page document was published in full on HeraldScotland earlier this year. Click here to read it
The Justice for Megrahi (JFM) campaign group called for an independent inquiry to look again at the conviction.