Libya's UN-backed Government of National Accord (GNA) has declared itself in full control of Tripoli after recapturing the capital's airport.
Gen Khalifa Haftar's forces have been besieging the city since April 2019.
But intensified military support from Turkey helped government forces drive Gen Haftar's troops back from the frontlines.
A new diplomatic effort is underway to try to restart talks on a lasting ceasefire.
The recapture of the international airport in Tripoli - long out of use - is the strongest symbolic victory for the Libyan government so far, reports the BBC's Arab affairs editor Sebastian Usher.
Libya has been torn by violence since long-time ruler Col Muammar Gaddafi was deposed and killed in 2011 by Nato-backed forces.
By 2014, Gen Haftar controlled the east from Benghazi, Libya's second city and the capital of Eastern Libya.
He tried to unify the country by taking his forces west to attack Tripoli, with the aim of unseating the GNA.
Gen Haftar's most important backers are Russia, the United Arab Emirates and Egypt.
In early May, a leaked UN report said that hundreds of mercenaries from a Russian organisation known as the Wagner Group - run by Yevgeny Prigozhin, a close associate of President Putin - was operating in Libya.
On 18 May, forces of the UN-recognised Tripoli government, fighting Gen Haftar's army, were photographed at a captured airbase, al-Watiya, just south of the Libyan capital.
According to the GNA, more than 1,000 Wagner Group fighters fled an area south of Tripoli on Russian transport planes, having been pushed back by GNA troops.
That evacuation was not confirmed by Gen Haftar's eastern-based Libyan National Army (LNA), nor by Russia.
Source : BBC