BENGHAZI, Libya (Reuters) - Libyan commander Khalifa Haftar declared victory on Thursday against rivals including local fighters and Islamists in the city of Derna, the last bastion of opposition against him in the east of the country.

Taking Derna, a city of 125,000 about 265 km (165 miles) west of Libya’s border with Egypt, marks an important step for Haftar’s Libyan National Army (LNA) as it tries to consolidate its power.

Based in eastern Libya, the LNA is one of the main factions that have vied for power since the 2011 Nato-backed uprising that ended more than four decades of rule by Muammar Gaddafi.

It was not possible to independently verify the extent of LNA control in central Derna, where the LNA’s rivals had been holding out. The victory announcement followed clashes in the city on Thursday and heavy airstrikes against the LNA’s opponents, military sources said.

“Thanks be to God, the armed forces control the entire city of Derna,” said a statement posted on the LNA’s Facebook page.

Haftar, who presents himself as the scourge of Islamist extremists, congratulated his supporters for what he said was a victory against “terrorists” in a televised speech.

“Today, the banner of terrorism is lowered by your victories, to be replaced by the banner of peace and tranquility despite the terrorists and those who support them,” said the 75-year-old commander, dressed in a khaki military uniform and standing at a podium next to a large Libyan flag.

LNA brigades launched a ground offensive in Derna last month after encircling and largely blockading the city over the past two years.

Seizing Derna completes the takeover of Libya’s east by Haftar, who built up the LNA during three-year campaign for Benghazi, Libya’s second city.

But the Derna fighting could also undercut U.N.-led efforts to stabilize Libya by reconciling eastern-based factions aligned with Haftar and rival groups located in the country’s more populous west.

Haftar’s victory announcement came days after the LNA moved to take control oil exports and revenues from eastern ports following fighting in two terminals.

In Derna, the United Nations has warned of the devastating impact of the LNA encirclement and recent fighting on residents.

It also expressed alarm earlier this month at allegations of serious human rights abuses including pillage, destruction of property, arbitrary detention and a video of summary executions.

After Haftar declared victory in Benghazi in July last year, fighting continued for several months in parts of the city. In Derna, the LNA’s progress has been much faster, aided by what their opponents said were precision air strikes carried out by drones.

Neighboring Egypt, one of several foreign powers that has provided support for Haftar, has in the past carried out air strikes in Derna against what it described as training camps sending militants into Egypt to carry out attacks.

Derna, known for its mixed social make-up and as a center of opposition to the Gaddafi regime, was the first Libyan city in which Islamic State established a foothold in 2014.

It was expelled the following year by a coalition of local fighters and Islamists known as the Derna Mujahideen Shura Council (DMSC). They later changed their name to the Derna Protection Force (DPF).