Libya's rival factions have agreed to maintain a lull in fighting and open internal land and air routes, the UN's envoy to the troubled North African country said Wednesday, expressing optimism about prospects for a ceasefire.

The two sides meeting in Geneva had agreed to "support and continue the current calm on the frontlines and to avoid any military escalation," said Stephanie Williams, acting head of the UN Support Mission in Libya (UNSMIL).

"I'm quite optimistic... there is an air of seriousness and commitment," she said on the prospect for a ceasefire.

But she stressed that "the degree of foreign intervention and foreign interference in Libya is unacceptable."

Libya has been wracked by conflict since the overthrow and killing of dictator Moamer Kadhafi in 2011 in a NATO-backed uprising.

Rival power centres and a myriad of militias are vying for control, human rights violations have been rampant, and traffickers are using the chaos to smuggle desperate migrants on dangerous sea journeys to Europe.

The capital Tripoli in the west is held by the internationally-recognised Government of National Accord (GNA), while a parliament based in the eastern city of Tobruk is backed by forces led by military commander Khalifa Haftar.

Haftar, supported by Russia, the UAE and Egypt, launched an offensive on Tripoli in April 2019 but was pushed back early this year as pro-GNA forces received crucial support from Turkey.

Fighting has since stalled around the central coastal city of Sirte, Kadhafi's hometown.

Williams said the UN's aim was to protect the 130,000 population of Sirte, previously held by Islamic State group militants.

The Geneva talks are the latest effort to bring peace, and the fourth round of the so-called 5+5 Joint Military Commission talks began on Monday.

The JMC is one of the three intra-Libyan tracks that UNSMIL is working on, along with economic and political tracks.

Libya has been wracked by conflict since the overthrow and killing of dictator Moamer Kadhafi in 2011
Libya has been wracked by conflict since the overthrow and killing of dictator Moamer Kadhafi in 2011 AFP / Mahmud TURKIA

Mohamed Eljarh, a Libya expert and co-founder of Libya Outlook for Research and Consulting, said the military talks were the most important track because they could be the basis for a full ceasefire deal.

"Without a military agreement, all the political negotiations and diplomatic efforts underway will come to nothing and will have no effective impact on the ground," he told AFP.

After two days of face-to-face discussions, scheduled to last until Saturday, the two sides agreed to reopen domestic transport links and also on moves to revive oil production in the country now mired in deep economic crisis, Williams said.

She added that following last week's first flight in 18 months between Tripoli and the eastern city of Benghazi, regular flights between Libya's two main cities would resume "towards the end of this week".

Afriqiyah Airways said on Facebook that it planned to operate its first regular Tripoli-Benghazi passenger flight on Friday and was studying re-opening air links with the country's south.

The two sides also agreed to open all the country's main highways including the key coastal road from Misrata to Sirte.

Williams said they would also work to boost oil output, delegating eastern and western commanders of the Petroleum Facilities Guards to work with the National Oil Corporation to restructure the PFG and ensure the continued flow of oil.

Libya's oil production, a vital source of income, has been repeatedly halted as various groups seized and blockaded key installations and export terminals.

The Guards, under the control of Libya's defence ministry before the revolution, have since morphed into armed groups with shifting allegiances.

Williams said the sides in Geneva had showed "real determination" to preserve Libya's unity and sovereignty despite "flagrant foreign intervention and blatant violations" of a UN arms embargo.

The delegations also agreed to support efforts towards the exchange of detainees, and on the need to end the use of inflammatory rhetoric, especially on social media, she said.

She urged the two parties "to solve all outstanding issues and forge a lasting ceasefire agreement".

Williams said both sides had agreed that "when a ceasefire agreement is reached, all foreign forces and mercenaries must depart the country within 90 days, under UN supervision.

"These are Libyan solutions," she said. "It's their country and Libya is for Libyans. That is why I continue to be very optimistic that the parties here are going to reach a more lasting and permanent ceasefire."

But analysts have warned that delegates negotiating in Geneva may not have full control over armed groups on the ground.