BENGHAZI, Libya (Reuters) - Islamic State fighters retreated from long-held positions around the port city of Derna on Wednesday, military forces in eastern Libya said, as troops loyal to the government in the region pressed on with an offensive in Benghazi.

A member of forces loyal to Libya's eastern government carries his weapon during clashes with the Shura Council of Libyan Revolutionaries in Benghazi, Libya April 19, 2016. REUTERS/Stringer

If the retreat around Derna is confirmed, it could mark a significant shift in the alignment of forces in the area.

Islamic State gained territory in Libya as two rival governments and a range of armed factions battled to control the country in the past two years. But it has also faced resistance from other local armed groups on the ground.

Derna has a history of Islamism and was an early bastion for Islamic State. The militant group lost control of the city last June to rival armed Islamists grouped under the Derna Mujahideen Shura Council, but retained positions around the outskirts.

Derna and its suburbs had been “completely liberated from the apostates”, the council said in a statement.

Eastern security forces, which are allied to a government based in the east, have carried out occasional strikes against Islamist rivals around Derna in recent months.

Military spokesman Abdulkarim Sabra said Islamic State had retreated from Derna’s 400 neighborhood and al-Fatayeh, 20 km (12 miles) south of the city, and its forces were trying to head towards the militant group’s Libyan stronghold of Sirte when they were intercepted.

The military was providing air support for troops, he said. There were no immediate reports of casualties.

Pictures circulating on social media showed some Derna residents celebrating and waving Libyan flags on the streets.

Eastern military forces have also been involved in heavy fighting around 250 km (155 miles) to the west in Benghazi, where they have taken several neighborhoods from fighters loyal to Islamic State and other groups.

Clashes continued there on Wednesday, and the military said it had nearly full control of the southern district of Guwarsha. It said one commander had been killed in the fighting and four soldiers were wounded.

The eastern government was set up after armed opponents took control of the capital, Tripoli, in 2014, and installed a rival administration. Both are backed by alliances of former rebels who once fought together to oust Muammar Gaddafi in 2011 but have slowly turned against each other.

Last month, a U.N.-backed unity government arrived in Tripoli, where it has been trying to establish its authority. The West sees the new government as the best chance of ending Libya’s political divisions and uniting its armed factions to take on Islamic State.

But the government has yet to win approval from Libya’s eastern parliament, which received international recognition and has repeatedly failed to hold a vote on the issue.

Lawmakers in the east who support the new government say they have been threatened and physically impeded from holding a vote, including when they tried to convene on Monday.

They have been opposed by allies of eastern military commander Khalifa Haftar, who are concerned about losing control of military appointments if the unity government takes full power.

In an apparent attempt to break the ice with the eastern military, the unity government’s leadership released a statement on Wednesday congratulating it on its advances in Benghazi.

The Presidential Council said it would “provide all necessary support to Benghazi and other affected cities for reconstruction,” and that it was committed to “supporting the institution of the army”.

It also congratulated the “people of Derna and all Libyans” on the “liberation” of the areas around where Islamic State retreated.