Libya's rival governments have reached a "consensus" on the main elements of a political agreement, a UN special envoy has told reporters.

Bernardino Leon said in Skhirat, Morocco, on Sunday that the two sides were able to "overcome their differences" on major outstanding issues, increasing the likelihood of signing a long-awaited agreement to form a unity government this month.

Leon said it was the first time "that we have the possibility to make it and to have this agreement with all the parties, all the key parties in Libya onboard," adding that both sides have made compromises.

Some Libya factions reach draft peace deal

"We know that it is going to require a lot of work, but we believe that it will be possible to reach this deadline of the 20th of September with an agreement that will be signed," said Leon.

The most recent text of the draft agreement was not immediately available but outstanding issues had related to military and state appointments during an interim period and how to appoint members of the High Council of State.

Since the 2011 overthrow and killing of longtime dictator Muammar Gaddafi, Libya has slid into chaos. The country is divided between an Islamist-backed government in Tripoli and the internationally recognised government in Tobruk.

Leon has been trying to get the parties to present candidates for prime minister and two deputies to lead a national unity government to bring the war-torn country out of its crisis.

He said the Tripoli government has been given 48 hours to submit names for leadership positions in a unity government, adding that the Tobruk-based government has already provided names.

* With additional reporting from AFP

Source: AP