Libyans have reacted with a mix of hope and scepticism after the signing of a nationwide ceasefire deal intended to pave the way towards a political solution to the country's grinding conflict.

While observers have welcomed the UN-backed deal, few are under any illusions about the difficulties of turning it into lasting peace on the ground.

"We've seen a lot of deals in the past," said Hassan Mahmud al-Obeydi, a 40-year-old secondary school teacher from the eastern city of Benghazi.

"What's important is the implementation."

Motorists drive past war-damaged buildings in Libya's main eastern city of Benghazi, where businessmen are desperate for Friday's "permanent" ceasefire to reopen trade with the unity government-held west
Motorists drive past war-damaged buildings in Libya's main eastern city of Benghazi, where businessmen are desperate for Friday's "permanent" ceasefire to reopen trade with the unity government-held west AFP / Abdullah DOMA

Friday's deal was signed in Geneva by military delegates from the two main warring parties in the North African country, which plunged into violence in 2011 with the NATO-backed revolt that toppled veteran dictator Moamer Kadhafi.

The Tripoli-based unity government and rival forces led by eastern military commander Khalifa Haftar agreed to withdraw from front lines, start demobilising armed groups and set about integrating them into the state.

Crucially, the deal also calls for the departure of all foreign forces from Libyan soil within three months.

"It's good that the two sides have been prepared to compromise, but the devil is in the detail," said Peter Millett, a former British ambassador to Libya.

Young men sit around at a pavement cafe in Benghazi, Libya's second largest city and once its joint capital
Young men sit around at a pavement cafe in Benghazi, Libya's second largest city and once its joint capital AFP / Abdullah DOMA

"There are an awful lot of questions. A key one is: will countries that have been sponsors of military forces in Libya support this compromise?"

Both major camps in Libya's complex war have received extensive backing from foreign powers.

Friday's deal comes four months after Haftar's Russian- and Emirati-backed forces gave up their year-long attempt to seize the capital Tripoli, a battle that killed hundreds of people and displaced tens of thousands.

In June, Haftar withdrew from western Libya in the face of a blistering counterattack by forces supporting the Government of National Accord -- backed by Turkey.

The battle had further deepened the bitter mistrust between the rival political camps and their military allies, as well as ordinary Libyans.

Just a few months ago, young males in Benghazi were being mobilised to head to the front line with unity government forces, around the city of Sirte just across the dividing line between east and west
Just a few months ago, young males in Benghazi were being mobilised to head to the front line with unity government forces, around the city of Sirte just across the dividing line between east and west AFP / Abdullah DOMA

"The war caused terrible social divisions," said Obeydi. "Work is needed immediately, right now, to rebuild and to heal the deep wounds in Libyan society."

In the capital Tripoli a 1,000-kilometre (630-mile) drive west, pro-GNA fighter Salim Atouch voiced doubts the ceasefire would hold.

SOUNDBITE "Today is a good day for the Libyan people" announces the UN's envoy to Libya after the North African country's two rival factions signed a "permanent" ceasefire agreement.
SOUNDBITE "Today is a good day for the Libyan people" announces the UN's envoy to Libya after the North African country's two rival factions signed a "permanent" ceasefire agreement. UNTV

"We have experience with a previous agreement, which was five days before Haftar's attack on Tripoli, during which he destroyed the capital's infrastructure and killed many people," Atouch said.

"I hope this won't be like previous agreements, meaning we go back to war again. We will abide by it, but we are ready to react at any moment if it's violated."

The Geneva talks were the military part of a process led by the UN's Libya mission UNSMIL.

Separate political talks that start Monday aim to create a new governing body and prepare for elections.

Mohamed Dorda, co-founder and consulting director of geopolitical risk consultancy Libya Desk, said the ceasefire was a positive step that "creates a basis for the political talks".

But, he warned, "Libya needs a security arrangement to allow a government to be set up. If we don't deal with the security crisis, we will find ourselves in same situation in a few years."

That is a complex challenge in a country prey to a patchwork of rival militias as well as foreign mercenaries and jihadist groups.

Observers have warned that those negotiating in Geneva do not necessarily control their armed allies on the ground.

Nor are foreign players in Libya likely to easily give up their hard-won influence.

Emadeddin Badi, a senior fellow at the Atlantic Council think tank, warned that Russia and Turkey would want economic dividends from their military interventions.

"It's naive to get them to just leave," he said. "The best case scenario is that they win economic concessions and limit their presence on the ground. The worst is that fighting resumes."

Yet despite all the obstacles, recent days have seen tangible progress.

This week, the two camps agreed to open domestic transport links and boost Libya's vital oil output, hard hit by fighting and blockades. Key oil installations have already restarted production after months-long shutdowns.

Massoud al-Fotmani, a 57-year-old from Benghazi who runs a group of food stores, said he hoped the ceasefire would hold.

"The war has caused a terrible economic downturn," he said. "We've lost a lot of money because of the cutting of commercial ties between east and west due to the roads being closed."

English teacher Mayssoon Khalifa, who works at a private school in Tripoli, echoed his call for a lasting peace.

"Many are hopeful, but not optimistic," she said. "I sincerely wish that this deal will hold. Libya deserves better."