Forces loyal to Libya’s UN-recognised Government of National Accord say they have captured a strategic town from General Khalifa Haftar, the warlord mounting a deadly siege of the capital, Tripoli.

GNA forces were shown on social media celebrating in Gharyan, a town 50 miles south of Tripoli that served as a supply line for Haftar. The GNA’s air force chased convoys of soldiers from Haftar’s Libyan National Army (LNA) leaving the city, and inflicted further casualties.

Although frontlines have swung back and forth in Libya, Haftar’s forces appeared to acknowledge a reverse, reacting angrily and claiming a counter-attack was already under way.

The LNA reverse, if it holds, appears to have been preceded by a series of local tribes demanding an end to the fighting or specifically calling on Haftar to retreat. The development places pressure on Haftar’s international backers, primarily Egypt and the United Arab Emirates.

The change in the military climate appears to be matched by a diplomatic upswing for the UN-backed government, including a GNA decision to resume cooperation with France. The GNA had ended cooperation, accusing the French president, Emmanuel Macron, of covertly backing Haftar. France, especially the foreign minister, Jean-Yves Le Drian, has been accused of seeing Haftar not as an autocrat but as a bulwark against political Islam and Islamist militia that dominate the weak GNA forces. The reconciliation occurred following meetings in Tunisia between the GNA and France.

Haftar’s attempt to capture Tripoli has been seen by Italy, and to a lesser extent the UK, as an attempt to destroy elaborate efforts by the UN special envoy, Ghassan Salamé, to form a genuine government of national unity leading to elections.

The LNA forces appear to have overestimated the degree to which militia inside Tripoli would switch sides and join Haftar once he appeared at the southern gates of the capital.

The UN has said nearly 700 people have been killed and tens of thousands displaced since the attack was launched on 4 April.

A fortnight ago the GNA prime minister, Fayez al-Serraj, revived a version of the UN peace plan including a national forum and elections by the end of the year. Serraj ruled out Haftar joining the reconciliation process.

There have also been talks between GNA members and the UN over a UN-led audit of the Central Bank of Libya (CBL), seen as one means of ensuring a better distribution of resources between east and west of Libya.

The head of the CBL, Saddek Elkaber, met the deputy UN special envoy in Libya, Stephanie Williams, to discuss the match between revenues submitted by the Libyan National Oil Corporation and the figures audited by the CBL.

Salamé himself met Haftar this week in a move that was criticised by Tripoli-based forces, some of whom accused him of corruption.

Haftar for his part has given a relatively rare interview insisting he is not an anti-democrat, and would only take power on an interim basis to prepare for these elections.