A U.N. special envoy says Libya's rival governments have reached a "consensus" on the main elements of a political agreement.

Bernardino Leon told reporters in Skhirat, Morocco early Sunday that the two sides were able to "overcome their differences" on major outstanding issues.

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

Leon says 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.

He says he hopes the text will be ready to be signed by Sept. 20.