The UN envoy for Libya has announced that rival factions in the strife-torn North African country have reached a draft accord which is "very close to a final agreement".
Bernardino Leon told reporters in the Moroccan resort of Skhirat on Sunday, at the end of the latest round of negotiations between the factions, that preparations were under way for armed groups to hold direct talks.
"I can tell you that we have now a draft which looks like something very close to a final agreement," he said.
"Eighty percent of the text in this draft is, let me put it this way, is something that the parties can agree."
Leon said the factions would return to Libya for consultations and return to Morocco "not this coming week but the following one" to finalise the agreement.
The envoy stressed however that any deal would need the approval of fighters on the ground, adding that his mission was hoping to convene a face-to-face meeting next week.
"This will be the first time the armed groups, the people who are holding weapons and who are fighting on the ground, might meet," he said.
"This is very important because all this work, all these efforts, will not work, will be useless, if we don't bring completely on board all those who are taking decisions on the ground, who are fighting on the ground."
Leon cautioned that "not everything is good news", referring to fighting inside Libya and a video purportedly showing Islamic State group jihadists executing some 30 Ethiopian Christians in Libya.
Friday's fighting near Tripoli between pro-government forces and armed groups killed at least 21 people, according to military sources.
"We know that the enemies of peace, the enemies of the agreement, will be active and be even more active in the coming days and weeks," Leon warned.
Libya has been divided since the 2011 uprising that toppled and killed dictator Moamer Kadhafi, with two opposing governments and parliaments and armed groups battling to control its cities and oil wealth.
On March 24, the United Nations Support Mission in Libya unveiled a six-point plan to end the crisis, including the formation of a transitional unity government until a new constitution is adopted and elections held.