Both sides in Libya’s conflict agreed to a cease-fire from Sunday to end nine months of fighting following weeks of international diplomacy and calls for a truce by power-brokers Russia and Turkey.

The oil-rich North African country has been wracked by bloody turmoil since a NATO-backed uprising killed long-time dictator Moammar Gadhafi in 2011, with multiple foreign powers now involved.

Since April last year, the U.N.-recognized Government of National Accord (GNA) in Tripoli has been under attack from forces loyal to eastern-based strongman Khalifa Hifter, which days ago captured the strategic coastal city of Sirte.

Late on Saturday, Hifter’s forces announced a cease-fire starting at midnight (Sunday 00:00 local time, Saturday 2200 GMT) in line with a joint call by Turkish President Recep Tayyip Erdogan and his Russian counterpart, Vladimir Putin.

Early Sunday the head of the GNA, Fayez al-Sarraj, also announced his acceptance of the cease-fire, saying it had taken effect at the start of Sunday.

The U.N. mission in Libya welcomed the announcements and called on all parties “to respect the cease-fire” and to support efforts to launch an inter-Libyan dialog.

Likewise, the Arab League called on Libya’s factions to “commit to stop the fighting, work on alleviating all forms of escalations and engage in good faith aimed at reaching permanent arrangements for a cease-fire.”

Since the start of the offensive against Tripoli, more than 280 civilians have been killed, 2,000 fighters have died and 146,000 Libyans have been displaced, according to the United Nations.

Sarraj stressed the GNA’s “legitimate right … to respond to any attack or aggression” that may come from the other side, while Haftar’s forces warned of a “severe” response to any violation by the “opposing camp.

Artillery fire could be heard shortly after midnight in the capital, before quiet settled over the southern Tripoli suburb where pro-GNA forces have been resisting Hifter’s offensive.

No cease-fire monitoring mechanism has been announced, but the GNA leader called for both sides to “prepare ceasefire measures under the aegis of the U.N.,” without providing further details.

The cease-fire comes after a diplomatic offensive, led by Ankara and Moscow, which have established themselves as key players in Libya, supporting opposing sides.

Ankara deployed military support to the GNA in January. Russia has been accused of backing pro-Hifter forces, which are also supported by the United Arab Emirates, Saudi Arabia and Egypt, all regional rivals of Turkey.

Erdogan and Putin called for a truce at a meeting on Wednesday in Istanbul, and Turkey on Saturday asked Russia to convince Hifter, who had initially vowed to fight on, to respect it.

Europe and North Africa have also launched a diplomatic offensive to try to prevent Libya, with the increased involvement of international players in its conflict, from turning into a “second Syria.

European governments, also including former colonial power Italy, are concerned that Islamist militants and migrant smugglers, already highly active in Libya, will take further advantage of the chaos.

The U.S. Embassy in Libya, in a statement Saturday, voiced its “serious concern about toxic foreign interference in the conflict.

It said “Russian mercenaries” had backed Haiter’s Libyan Arab Armed Forces while “Turkish-supported Syrian fighters” had backed the GNA, a development that had “significantly degraded security, to the detriment of all Libyans.

It continued: “All responsible Libyan parties should end this dangerous escalation and reject the destructive involvement by foreign forces.”

On Saturday Putin and German Chancellor Angela Merkel met in Moscow and called for international efforts to address the crisis in Libya.

Merkel said she hoped “the Turkish-Russian efforts will be successful,” calling a cease-fire a first step in a peace process.

Putin and Merkel both backed a Libya peace conference in Berlin being organized by U.N. special envoy to Libya, Ghassan Salame, which could be held in the coming weeks.

Putin on Saturday again denied Russia had deployed mercenaries to Libya, saying: “if there are Russians there, they do not represent the interests of the Russian state and do not receive money from it.”