Rival Libyan politicians signed Thursday a deal on a unity government despite opposition on both sides, in what the United Nations described as a "first step" towards ending the crisis.
World powers have urged the warring factions to break a political deadlock that has allowed jihadists and people-smugglers to flourish since the fall of dictator Moamer Ghadhafi in 2011.
A group of lawmakers from Libya's rival parliaments, as well as other political figures, inked the UN-sponsored accord in the Moroccan resort of Skhirat, an AFP journalist said.
But even within the two legislatures the deal has caused deep divisions.
The heads of both parliaments have warned that the agreement has no legitimacy and the politicians signing the agreement represented only themselves.
UN envoy Martin Kobler acknowledged that much remained to be done to end the turmoil.
"This is just the beginning of a long journey for Libya. Signing is only the first step on the road to putting Libya back on the right track," he said at the ceremony.
"The door is always open to those who are not here today. The new government must move urgently to address the concerns of those who feel marginalised."
The signing follows a gathering in Rome of a US- and Italian-led group of world powers and regional players that called on the two sides Sunday to lay down their arms and back a new unity government.
Nouri Abusahmein, who heads the militia-backed General National Congress (GNC) in Tripoli that is not recognised by the international community, said Wednesday that the signatories did not represent the parliaments.
"Whoever has not been commissioned by the GNC to sign or initial a deal on its behalf is, and will remain, without legitimacy," he said before the legislature in the capital.
A government such as that proposed by the United Nations "is not the subject of consensus and does not even guarantee the minimum required to ensure its effectiveness", he added.
On Tuesday in Malta, Abusahmein met Aguila Saleh who heads the internationally recognised parliament based in Tobruk in the east near the border with Egypt.
It was the first time they had met since the rival administrations were formed in 2014.
At a joint news conference, both men said that those who sign the agreement represent only themselves.
At the beginning of October in Skhirat, delegations from both sides approved a draft agreement negotiated under the auspices of the UN, but it was later rejected by their parliaments.
Abusahmein and those MPs who support him are not against an agreement, but say they want more time to negotiate it.
On December 6, members of the two bodies launched an alternative process in Tunis by signing a "declaration of interest" on a unity government, and this process is backed by the two parliament heads.
The country has been mired in chaos since the 2011 overthrow and killing of long-time dictator Ghadhafi.
On Wednesday, Kobler met the recognised government's controversial army chief General Khalifa Haftar.
Haftar said he was not satisfied with the UN deal, which stipulates that if the rival authorities fail to agree on who should head the army within 10 days, a new military chief will be appointed.
But he said he would not "boycott" the agreement.
Many members of the Tripoli parliament oppose Haftar.
The recognised government says the embargo is hampering the battle against the Islamic State (ISIS) militant group, which seized control of the coastal city of Sirte in June.