The last 500 tons of chemical weapons stockpiled by the former Libyan dictator Gaddafi have been removed from the North African nation by a Danish extraction team.

The Associated Press reported the Danish-led operation had successfully removed the last of the deadly weapons from Libya, which has been gripped by anarchy since its revolutionary war in 2011.

Denmark's Foreign Minister said the chemicals of an unspecified description had been removed from Libya on 27 August through the port city of Misrata.

We have now removed the chemical remnants from Libya and have ensured that they will not fall into the wrong hands," Foreign Minister Kristian Jensen was quoted as saying.

UK warships, deployed in the Mediterranean as part of the EU's naval mission Operation Sophia reportedly helped with the extraction in conjunction with Finnish counterparts.

Libya's UN-backed Government of National accord made a formal request in July for the weapons to be removed. The internationally recognised government led by Fayez Serraj has held a tentative grip on the country's capital Tripoli since it arrived in Libya in March but it has very little power outside the city's confines.

Militias – remnants of Libya's war – against Gaddafi, have been waging an ongoing ground war against the Islamic State which was believed to have thousands of fighters in the central city of Sirte.

As the militias, the majority of them from Misrata. clear the last of the militant fighter from the city, it is believed their leaders have fled into Libya's expansive southern deserts.

The proliferation of small arms, rather than chemical weapons from Libya – from huge stockpiles amassed by Gaddafi over the course of his 40-year-rule – have proved disastrous for the region. The guns fuelled conflict in Mali, allowing al-Qaeda to hijack an ethnic Tuareg rebellion and to project power from the historic city of Timbuktu.

The UN has said the weapons held in massive, unguarded caches have been found in Egypt, Nigeria and have been used in the conflict in Syria.