Rival Libyan factions overcame last-minute disagreements and signed a United Nations-brokered peace deal on Thursday that supporters hope will help end years of deepening turmoil and counter Islamic State militants in the country.

A majority of members from both the Tripoli-based General National Congress and the House of Representatives in the eastern city of Tobruk were present at the signing in Skhirat, Morocco. Along with delegates from around Libya, they represented about 80 percent of the nation’s diverse groups and factions.

“Today is a historic day for Libya,” UN envoy Martin Kobler said. “All the parties have made concessions, putting the interests of the country first. The international community will continue its support for the future Libyan government.”

The two opposing administrations, each with its own legislature and armed allies, have tussled over oil and power for more than a year, shattering the economy and creating a vacuum that allowed Islamic State to thrive. Analysts have cautioned the divisions are so deep, there is no guarantee the deal will hold.

The UN road-map for a way to end the chaos triggered by the fall and slaying of ex-leader Muammar Qaddafi four years ago was endorsed by 17 nations in Rome last Sunday. They included the five permanent members of the UN Security Council, large EU states and Libya’s neighbors.

Before it's here, it's on the Bloomberg Terminal. LEARN MORE