Accord signed in Morocco aims to form unity government and end years of violence and chaos in North African nation.

Libya’s two rival factions have signed a UN-backed deal to form a unity government at a ceremony in Morocco.

Chants of “Libya, Libya” erupted as representatives from both parliaments signed the accord on Thursday in Skhirat, just south of the Moroccan capital Rabat.

The peace deal calls for a presidential council to lead a unified government, but sections in both factions reject it and questions remain about how it will be implemented.

Libya has been locked in conflict since a NATO-backed revolt that overthrew long-time leader Muammar Gaddafi four years ago.

A civil war has seen the emergence of numerous armed groups, forcing several countries to evacuate their citizens and diplomats.

It is hoped the long-delayed peace agreement will end the years of chaos in the oil-rich North African nation.

Anas El Gomati, director of the Sadeq Institute, a Libyan think tank, said it had been a long journey of negotiations.

“It’s a positive step, definitely. But it’s a very, very long journey towards sustainable peace,” he told Al Jazeera from Tunis.

Libya’s rivals are mainly split between the General National Congress, based in the capital Tripoli, and the internationally recognised House of Representatives, based further east in Tobruk.

“This is the beginning of building a new Libya,” Salaheddine Mezouar, Morocco’s foreign minister, declared before Thursday’s signing ceremony.

National unity government

The peace deal envisages a national unity government and an end to fighting between forces loyal to the two competing parliaments.

But even if the pact is eventually signed, powerful armed groups on the ground are unlikely to comply with it because they see as it as biased and as harming their interests, observers say.

Martin Kobler, the UN envoy for Libya, earlier said in a statement that the large number of Libyans present at the ceremony as well as high-level international participants, including many foreign ministers, were committed to the deal.

“The United Nations encourages all Libyan efforts to end the current divisions through inclusive dialogue, and I will continue to actively engage with all Libyans to that end,” he said.