The infighting and lawlessness allowed extremist groups such as IS to seize several coastal regions, giving the jihadists a toehold on Europe's doorstep.

The capture of Sirte, first announced on December 5, boosts the authority of Sarraj’s Government of National Accord (GNA), which was launched in Tripoli in March but whose legitimacy is contested by a rival administration based in eastern Libya.

Libya’s unity government leader Fayez al-Sarraj has officially announced the end of military operations in Sirte, after the liberation from Islamic State group forces of what was the last significant territory they held in the country. However prime minister-designate Sarraj warned that the battle against the Islamic rebels was not over.

Watch what else is making news:

Eight months after the start of the operations against IS in the coastal town of Sirte “I officially announce the end of military operations and the liberation of the town”, Sarraj said in a televised speech, two weeks after the announcement that the area was in control of forces loyal to the government. The capture of Sirte, first announced on December 5, boosts the authority of Sarraj’s UN-backed Government of National Accord (GNA), which was launched in Tripoli in March but whose legitimacy is contested by a rival administration based in eastern Libya.

The country descended into chaos following the NATO-backed ousting of longtime dictator Moamer Kadhafi in 2011, with rival administrations emerging and well-armed militias vying for control of its vast oil wealth. The infighting and lawlessness allowed extremist groups such as IS to seize several coastal regions, giving the jihadists a toehold on Europe’s doorstep.

The fall of Sirte – Kadhafi’s home town located 450 kilometres (280 miles) east of Tripoli – is a major setback for IS, which has also faced a series of military defeats in Syria and Iraq. Sarraj made the announcement on Sirte on the first anniversary of the signing of a peace agreement in Morocco.

“The battle for Sirte is over but the war against terrorism in Libya is not finished,” he warned, stressing the need to unify the various military forces into “one single army”. The GNA is the centrepiece of Western hopes to stem the upsurge of jihadism in Libya, as well as to halt people trafficking across the Mediterranean that has led to thousands of drownings. But the unity government headed by Sarraj has struggled to replace the two rival administrations.