Libya's second city of Benghazi had been liberated, Haftar announced on television, hours after his self-styled Libyan National Army (LNA) said it had cornered remaining jihadists in the central city district of Al-Sabri.

"We announce to you the liberation of Benghazi from terrorism," he said, while thanking all who "supported us."

His speech was followed by what was described as "celebratory gunfire" and fireworks

Haftar claims his LNA has 'liberated' Benghazi

Read more: Obama calls Libya his 'worst mistake'

Fragmented Libya is the destination for migrants trying to reach Europe and recently prompted a visit by Germany's foreign minister.

Haftar, once an ally of longtime Libyan autocrat Moammar Gadhafi who was ousted and killed in 2011, reputedly draws his backing from Egypt and the United Arab Emirates.

On television, he pledged a new era of "stability, prosperity and peace" for Benghazi while acknowledging heavy LNA casualties, saying a "caravan of martyrs" had fallen in battle to evict jihadists.

They overran the city three years ago, resisting what they saw as his military rule.

Libya descended into conflict and lawlessness after the ouster and death of Moammar Gadhafi

Last week, a medical source said 44 LNA soldiers had been killed in June alone in Benghazi's districts of Al-Sabri and Souq al-Hout.

The alliance of Islamist militias, calling itself the Revolutionary Shura Council of Benghazi, included suspected members of the Islamic State (IS) group and the al-Qaida-linked Ansar al-Sharia.

From Tripoli in May, Libya's UN-backed government led by Fayez Serraj said Haftar must accept civilian rule in order to play a role in the future of the oil-rich country split between rival militias and rival administrations.

The Serraj government has been unable to gain recognition from an elected parliament based in Tobruk.

ipj/bw (Reuters, AP, AFP)