Members of Libya's rival parliaments on Thursday signed a landmark, UN-sponsored deal on forming a unity government that will strive to bring peace to the war-ravaged country. Supporters of the agreement hope that rival political factions and militias will embrace the deal and agree on a cease-fire, so that they can fend off Daesh (the so-called) extremist group, which is expanding its gains in the North African country. The document was signed in Morocco by Emhemed Shoaib, the deputy speaker of the internationally recognized Libyan parliament, and Salah Al-Makhzoum, the second deputy of the Islamist-backed parliament based in the capital, Tripoli. Libya slid into chaos following the 2011 toppling and killing of longtime ruler Muammar Gaddafi. Over a year ago, it was further torn — in addition to having two parliaments — between the internationally recognized government, based in the country's east, and the Islamist-backed government in Tripoli. "This is just the beginning of a long journey for Libya," said UN envoy Martin Kobler, who attended the Morocco ceremony. "Signing is only the first step on the road of putting Libya back on the right track." Al-Makhzoum said while the deal is not perfect, it's a step to rescue Libya from collapsing and ensure its unity. The agreement has detractors on both sides who seek a separate deal without UN involvement. The speakers of the two parliaments — Tripoli-based Nuri A.M. Abusahmain and Aguila Saleh Issa from the east — were not at the Morocco ceremony. The two, who are seen by analysts as hard-liners, held talks on Tuesday in Malta to forge a separate deal without UN involvement. Afterward, they issued a statement saying the representatives who travelled to Morocco were not mandated to represent the parliaments in the talks. Before the start of Thursday's ceremony, Al-Makhzoum and Faraj Abu-Hashem, the spokesman for the east-based parliament, told The Associated Press that 88 lawmakers from the two parliaments were present at the signing. The eastern parliament has 156 known members, while the rival parliament in Tripoli has 135. The foreign ministers of Turkey, Italy, Spain, Qatar, Tunisia, and Morocco also spoke at the ceremony in support of the deal. Among the first to welcome the deal was French Foreign Minister Laurent Fabius, who praised the accord and promised to support efforts by a new unity government. "The priority should now go toward creating a national unity government," he said in a statement. "That's the condition for tackling terrorism and trafficking that threaten the security of the region and Europe."