The eccentric and erratic former colonel, who came to power in 1969 when he overthrew King Idris, ruled the country with a rod of iron until February 2011.
Then the Arab Spring, which had begun in neighboring Tunisia two months earlier, led to his overthrow and his brutal murder in the streets of his hometown, Sirte.
But his death, like that of Saddam Hussein in Iraq, created a vacuum in the North African country which is overwhelmingly Arab and Muslim.
In December 2015 Libya's rival governments (the internationally recognized Council of Deputies based in Tobruk and the Tripoli-based General National Congress) agreed to create a Government of National Accord (GNA) under Fayez Sarraj.
Since 2011, WFP's been providing emergency food assistance to families in Libya. Conflict across the country is causing major food shortages pic.twitter.com/KCBU3BGXzX— World Food Programme (@WFP) 25 July 2017
But Mr. Sarraj faced uprisings from various tribal militias as well as from a new group, the Libya National Army (LNA), which is based in Benghazi and led by Field Marshal Khalifa Haftar.
The UN-backed GNA operates in the country's west and is headquartered in Tripoli. The eastern part of the country is governed by its parliament, which is backed by Haftar's LNA.
Earlier in July Marshal Haftar, 73, said his forces had fully liberated the country's second biggest city, Benghazi, from the Benghazi Revolutionary Shura Council, an extremist Islamist group linked to Daesh.
He was congratulated on the operation by the Crown Prince of Abu Dhabi and Deputy Supreme Commander of the UAE Armed Forces, Sheikh Mohamed bin Zayed Al Nahyan.
On Tuesday (July 25) the GNA and the LNA agreed to a ceasefire in the embattled country at talks in Paris hosted by French President Emmanuel Macron. They also agreed on further talks under the auspices of the newly appointed UN envoy to Libya, Ghassan Salame. They also promised to ensure a unified government and elections to put an end to the crisis and bring stability to the country.
European Union leaders are desperately hoping to restore a strong central government which will be able to clamp down on the people smugglers who have used the Libyan coast as the starting point for hazardous voyages across the Mediterranean for migrants heading to Europe from various war-torn and impoverished nations in the Africa and the Middle East.
The talk is all very well but can the question is whether they can actually turn it into action and stave off the chaos which allows Daesh to use part of the country as a terrorist training camp.
Jalel Harchaoui, a Libya expert at Paris 8 University, said the talks were flawed because there were so many factions which would abide by what had been agreed on Tuesday.
"Sarraj and the entire UN-backed government are in a very, very weak position compared to the day on March 30, 2016 when they arrived in Tripoli. He was much stronger then," Mr. Harchaoui told Sputnik.
He said Haftar — a professional soldier who served under Gaddafi — would be happier with the outcome of the talks than Sarraj.
"Haftar has come to Paris looking for two things. He was looking for recognition and political prestige, and he got that, and he was also looking to buy time. So he is going away from Paris a happy person. I think he is the clear winner in this initiative," Mr. Harchaoui told Sputnik.
France's involvement in the peace process has antagonized Italy, the former colonial power which feels slighted. One opposition politician, Giorgia Meloni, criticized the government in Rome.
Tweet: "The Libyan meeting organized by France shows the total failure of Italy's foreign policy"
The lack of a strong, unified government has led to chaos in Libya with up to 1,700 different groups, many of whom are armed to the teeth with weapons stolen from the former arsenals of the Gaddafi regime.
Tunisia, which is worried about its fragile tourism industry, has built a partial security barrier and trench along its border with Libya aimed at preventing attacks.
Mr. Harchaoui said the spirit of the December 2015 agreement was required.
"It compelled all political factions in Libya to speak to each other and what we have seen here in Paris is that France is officially sticking to that line but in practice it is happy to do what Egypt, the (United Arab) Emirates and Marshal Haftar have been doing, which is to ignore the actors they don't like. As long as we see major players taking the liberty of ignoring political opponents and forced them to use the military route we will continue to see violence in Libya," Mr. Harchaoui told Sputnik.