SKHIRAT, Morocco (Reuters) - Delegates from Libya's warring factions signed a U.N.-brokered agreement on Thursday to form a national unity government, a deal that Western powers hope will bring stability and help to combat a growing Islamic State presence.
Four years after Muammar Gaddafi's fall, Libya is deeply fractured, with a self-declared government in Tripoli and an internationally recognised one in the east - each backed by coalitions of former rebels and militias.
The U.N. deal calls for a presidential council to lead a unified government, but hardliners in both factions reject it and questions remain about how it will be implemented in a country where rival armed brigades hold the key to power.
Chants of "Libya! Libya!" erupted as representatives from both parliaments signed the accord along with local councils and political parties in the Moroccan coastal town of Skhirat, after more than a year of hard-scrabble negotiations.
"The doors remain wide open to those who are not here today," U.N. envoy Martin Kobler said at the ceremony attended by regional foreign ministers. "The signing of the political agreement is only the first step."
Western officials believe war fatigue, promises of foreign aid, the strain on Libya's oil economy and the common threat of Islamic State will help to build momentum for the national government and bring opponents on board.
Under the deal, a nine-member presidential council will form a government with the current, eastern-based House of Representatives as the main legislative and a State Council as a second consultative chamber. The presidential council will name a new government in a month and a U.N. Security Council resolution will endorse it.
"There are some people who want to hold on to little kingdoms, but very, very small kingdoms, little tiny patches where they hold authority, but Libya's going to move on," U.S. envoy to Libya Jonathan Winer told Reuters. "Ultimately Libyans have to be responsible for Libya."
Still, the agreement faces questions from critics about how representative the proposed government will be, how it will set up in Tripoli and how various armed factions on the ground will react to a new government. Some brand it a U.N.-imposed deal.
Some of Libya's armed brigades have backed the deal, while others are closely allied with political leaders who oppose it.
"We have reached an agreement, but the biggest challenge now is to implement it," said Salah Huma, a member of parliament and negotiator for the eastern-based government.
The chiefs of each rival parliament have already rejected the U.N. deal and called for more time to negotiate a Libyan initiative, though diplomats say both men may face international sanctions for blocking a vote on the agreement.
Since revolution ousted Gaddafi, Libya has struggled with almost constant instability as heavily armed brigades of former rebels and their political allies squabbled for control of the vast country and its oil resources.
Battered by protests and attacks, oil production that accounts for most government revenue is now less than half of the 1.6 million barrels per day level prior to 2011. Major ports and pipelines are still closed, locking in exports.
Last year fighting intensified when one armed faction took over Tripoli, set up its own government and reinstated the old parliament, the General National Congress. Since then, the recognized government and elected House of Representatives have operated out of the east of the country.
In the chaos, Islamic State militants have steadily expanded their presence, taking over the city of Sirte, attacking a hotel and a prison in Tripoli, ransacking oilfields to the south of Sirte and executing a group of Egyptian Christians.
Western officials say the priority after making the political agreement work will be securing Tripoli for the new administration and then rebuilding a national army with training and equipment. It may also include foreign advisers.
"Building the Libyan army and the police would not come overnight, you wouldn't wake up and all the militias are gone," Kobler told Reuters. "This is a long process, and the army has an important role and has to be unified."
Additional reporting by Ayman Al-Warfalli in Benghazi; writing by Patrick Markey; Editing by Dominic Evans and Gareth Jones