Forces loyal to Khalifa Haftar, the head of the Libyan National Army (LNA), on Thursday declared victory against rivals, including local fighters and militants, in the city of Derna, the last bastion of opposition to Haftar in the east of the country.
"Thanks be to God, the armed forces control the entire city of Derna," Haftar said in a statement on Facebook.
The city is the last in eastern Libya to elude their control, but after encircling the city for around two years, brigades from Haftar's LNA launched a ground offensive last month.
In a speech broadcast on Libyan television, Haftar, dressed in military uniform, congratulated his supporters for what he said was a victory against "terrorists".
"Today, the banner of terrorism is lowered by your victories, to be replaced by the banner of peace and tranquillity despite the terrorists and those who support them," Haftar said.
Seizing Derna city completes the takeover of Libya's east by Haftar, who built up his LNA during a three-year campaign for Benghazi, Libya's second city.
But the Derna fighting could also undercut UN-led efforts to stabilise Libya by reconciling eastern-based factions aligned with Haftar and rival groups located in the country's more populous west.
Last week, Haftar announced the handover of oil installations under the control of his forces to his allies in the east Libya administration after retaking them from militias.
A UN-backed unity government based in Tripoli has struggled to assert its authority outside the west while Haftar has been the military figurehead for the government based in Tobruk.
The UN has warned of the devastating impact of the LNA encirclement and recent fighting on Derna's 125,000 residents.