Libya's rival politicians sign deal to form unity government in a nation split by conflict.
Libya has turned a page in efforts to achieve reconciliation and stability after being in chaos since 2011 after the overthrow of long-serving ruler Muammar Gaddafi by Nato-backed forces.
Libya has two rival governments, one based in the main city, Tripoli, and the other about 1,000km away in the port city of Tobruk. The two rival governments recently held talks to discuss a way to end the conflict in the nation. Armed groups which control much of Libya were not part of the talks
However, the heads of the rival parliaments failed to sign the deal because of major disagreements.
The signing draws a line under a 14-month political process that gained more prominence in recent months because of the large influx of refugees and migrants to Europe, and the growing threat of Islamic State militancy in the country.
Diplomats put extra pressure on the Libyan delegates in recent weeks because in order to address those issues they need a single government to work with. Some observers sounded alarm bells ahead of the signing, cautioning that it could further divide Libya if it did not include all the key players and not everyone was present at the ceremony in Morocco.
A security plan to protect the new unity government which at the moment only exists on paper is crucial, and this does not exist. This latest step is a huge gamble.
It could yet prove to be a springboard for a wider agreement that eventually unites Libya. But if it fails, it may lead the country into a darker spiral of violence over legitimacy and control.
Amid the turmoil, Libya has become a major departure point for some of the thousands of migrants travelling to Europe from Africa.
There is also international concern that the militant so-called Islamic State (IS) group is taking advantage of the instability to expand inside Libya.
The new government would have to tackle the dire humanitarian situation in Libya, and fight IS and other jihadi groups.
Around 80 of the 188 members of the Tobruk-based parliament and 50 of the 136 rival lawmakers in Tripoli signed the deal; the AFP news agency quotes participants as saying.
Ousted the former regime are now fighting among themselves
On Tuesday, the heads of the two parliaments, Agila Salah of Tobruk and Nouri Abusahmen of Tripoli, said they had not authorized anyone to sign the agreement on their behalf. Mr. Salah pleaded for more time, warning that "acting hastily would lead to more problems in the future".
Mr Abusahmen said "we will not accept foreign intervention against the will of the Libyan people" referring to the UN-backed deal.The two leaders met for the first time in Malta on Tuesday.
Mr Salah's parliament is internationally recognized, and based itself in Tobruk after being driven out of Tripoli.