Libya's long-divided parliament voted on Wednesday to back a unity government that has emerged through a UN peace process as part of a plan to resolve a decade of chaos and violence with an election in December.
The parliament's approval of Prime Minister Abdulhamid Dbeibeh's cabinet by 132 votes to two against, at a session in a war-battered frontline city, represents the biggest opportunity in years for a resolution to Libya's conflict.
"Through this vote, it became clear that the Libyans are one unit," Dbeibeh told parliament afterwards. He urged Libyans to "open your hearts to one another and forget the grudges".
However, huge hurdles remain and the manner of Dbeibeh's own appointment and the expansive size of his cabinet have drawn criticism in Libya with accusations of corruption and influence peddling that spoilers could leverage to deny his legitimacy.
On the ground, Libya's streets, businesses and even its institutions of state remain in the shadow of myriad armed forces and split between two warring administrations, while foreign powers backing either side have kept their guns in place.
Holding free parliamentary and presidential elections in such circumstances in 2021 will be an immense challenge, though all sides have formally committed to do so. First the constitution must be amended - another difficult undertaking.
"If we come out of this with one government and one set of institutions then we're already in a far superior place than we've been for the last five years," said Tarek Megerisi of the European Council on Foreign Relations.
The parliament session was in Sirte, where the front lines stabilised last summer after the internationally recognised Government of National Accord (GNA) pushed Khalifa Haftar's eastern-based Libyan National Army (LNA) back from Tripoli.
It was parliament's first full session in years after it split between eastern and western factions soon after being elected in 2014 - three years after an uprising that toppled Muammar Gaddafi plunged the oil-producing country into chaos.
A ceasefire has held since the autumn, but the main road across the front lines from Sirte to Misrata remains closed and lawmakers coming from the west had to fly in from Tripoli.
Russia's Wagner mercenaries, sent to Libya to support Haftar, remain entrenched around Sirte and other parts of the country. The United Nations has accused them of lacing areas of southern Tripoli with booby traps when they pulled out last year, causing dozens of civilian deaths.
Haftar was also backed by the United Arab Emirates and Egypt, while Turkey supported the GNA. Dbeibeh said on Tuesday that economic deals the GNA struck with Turkey should stand.
Both Libya's rival administrations are now supposed to be replaced by Dbeibeh's unity government, made up of 35 cabinet members intended to reflect regional and political factions.
Critics of the process say it has merely rearranged the tangle of alliances and enmities among power brokers who have dominated Libya for years, without disrupting their ability to loot its wealth or spoil unfavourable settlements.
They are also angry that the accusations of corruption in Dbeibeh's appointment have not been formally debated. He was chosen by the 75 members of a UN political forum that met in Tunis and Geneva and voted on leadership candidates.
Some forum delegates were quoted saying their colleagues had been offered money. Dbeibeh, along with three members of a presidency council also selected in Geneva, has promised not to seek further office in the election.
Several ministers in the unity government were changed at the last minute after intense negotiations to accommodate powerful players in parliament.
However, despite the problems with the process and the obstacles remaining, Libya stands on the cusp of a first unified government in years and with all sides formally committed to elections.
On Tuesday, the first civilian airline flight in six years took place between the cities of Benghazi and Misrata - tangible evidence of detente.
"It is good for us to have one government after almost eight years...but it is more important for the government to abide by the agreement and bring the country to elections," said Khaled Al-Ajili, 42, a businessman in a Tripoli cafe.