Libya's warring rival administrations announced in separate statements yesterday that they would cease all hostilities and organise nationwide elections, a move widely welcomed by the UN and several countries.

The surprise announcement came after multiple visits by top foreign diplomats to Libya in recent weeks, resulting in the first deal between the rival authorities since a December 2015 UN-backed accord in Morocco that led to an agreement on a unity government.

The statements were signed by Fayez al-Sarraj, head of the UN-recognised unity Government of National Accord (GNA), based in the capital Tripoli, and Aguila Saleh, speaker of the eastern-based parliament, backed by military strongman Khalifa Haftar.

The two have been at war virtually since the formation of Sarraj's government in December 2015.

The UN's top official to Libya, Stephanie Williams, called for "all parties to rise to this historic occasion and shoulder their full responsibilities before the Libyan people".

Sarraj called for the holding of "presidential and parliamentary elections next March", and for the "end of all combat operations".

Saleh also backed elections — though he did not specify a date — and urged "all parties" to observe "an immediate ceasefire and the cessation of all fighting."

Italy welcomed the move, as did Germany and the Arab League.

"The announcement of the ceasefire in Libya is an important step in the relaunching of a political process that will promote the stability of the country and the welfare of the people," Italian Prime Minister Giuseppe Conte said.

The European Union's diplomatic chief Josep Borrell praised the agreement as "important and positive" and called on all factions in the North Africa state to keep their commitments.

"Important and positive news coming from #Libya on a ceasefire and the resumption of a political process," Borrell tweeted. "Crucial now that all parties stand by their statements. All Libyans deserve a political solution and a return to stability and peace."

International pressure has sought to bring rival leaders to an agreement several times in past years, but has failed to secure a lasting peace.

Libya's National Oil Corp (NOC) also welcomed Friday's announcement, including proposals it said the rivals had made to resume production and export of oil.

Earnings from Libya's lucrative oil fields have been a source of intense disagreement between the two sides, including a months-long blockade of oil terminals.

"NOC reiterates its call for all oil facilities to be freed from military occupation to ensure the security and safety of its workers," the state oil producer said in a statement.

"Once this has been done, NOC should be able to re-commence oil export operations."

Libya has been in chaos since a Western-backed uprising toppled and killed longtime dictator Muammar Gaddafi in 2011.

Haftar launched an offensive in April 2019 to seize Tripoli from the GNA.

After 14 months of fierce fighting, Turkish-backed pro-GNA forces expelled Haftar's troops from much of western Libya and pushed them eastwards to Sirte, but where fighting has stalled.

Sarraj said a ceasefire would allow the creation of "demilitarised zones" in Sirte and the Al-Jufra region, currently under the control of pro-Haftar forces.

Saleh did not mention the demilitarisation zones, but proposed the installation of a new government in Sirte.

But analyst Jalel Harchaoui, research fellow at The Hague-based Clingendael Institute, said there was a long road ahead before peace.

"The question is, is this announcement fully achievable? In all likelihood, implementation will be difficult," said Harchaoui, noting the multiple regional forces who could act as spoilers of a deal.