Both sides in Libya's conflict agreed to a ceasefire 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 2011 NATO-backed uprising killed long-time dictator Moamer Kadhafi, with multiple foreign powers now involved.
The UN-recognised Government of National Accord (GNA) in Tripoli had been under attack since last April from forces loyal to eastern-based strongman Khalifa Haftar, which on January 6 captured the strategic coastal city of Sirte.
Late on Saturday, Haftar's forces announced a ceasefire 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.
GNA head Fayez al-Sarraj, who met Erdogan in Istanbul on Sunday, confirmed the ceasefire had taken effect.
The UN mission in Libya welcomed the announcements and called on all parties "to respect the ceasefire" and support efforts to launch an inter-Libyan dialogue.
European embassies in Tripoli, in a joint statement, urged Libya's rival parties "to seize this fragile opportunity to address the key political, economic, and security issues underlaying the conflict".
The Arab League likewise urged 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 ceasefire".
Neighbouring Algeria, at the centre of a flurry of diplomatic activity on Libya, called for a "swift return to the process of national dialogue to reach a political solution".
Putin held talks on the telephone Sunday with Italian Prime Minister Giuseppe Conte and French President Emmanuel Macron, who both voiced support for a planned international conference on Libya to be held in Berlin, the Kremlin said.
Since the start of the offensive against Tripoli, more than 280 civilians and about 2,000 fighters have been killed and 146,000 Libyans displaced, according to the UN.
- Diplomatic offensive -
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 Haftar's offensive.
The GNA, however, stressed that "any ceasefire initiative cannot succeed without the withdrawal of the aggressor from where they came", from the country's east and south.
Turkey's defence ministry said: "The belligerents have been trying to respect these truces since they came into force... and the situation has been calm apart from one or two isolated incidents."
Libya analyst Wolfram Lacher said that the calm on the ground reflected a success for both Turkey and Russia.
"The widespread observance of the ceasefire until now is a stunning demonstration of newfound Russian and Turkish influence in Libya," he said.
The truce comes after a diplomatic offensive, led by Ankara and Moscow, which have established themselves as key players in Libya.
Ankara despatched troops -- in a training capacity, it said -- to the GNA in January.
And Russia has been accused of backing pro-Haftar forces, which are 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 last Wednesday in Istanbul, and Turkey later asked Russia to convince Haftar, who had initially vowed to fight on, to respect it.
- Fears of a 'second Syria' -
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, including former colonial power Italy, fear that Islamist militants and migrant smugglers, already highly active in Libya, will take further advantage of the chaos.
The US embassy in Libya, in a statement Saturday, voiced its "serious concern about toxic foreign interference in the conflict".
It said "Russian mercenaries" had backed Haftar's Libyan Arab Armed Forces, while "Turkish-supported Syrian fighters" had backed the GNA.
"All responsible Libyan parties should end this dangerous escalation and reject the destructive involvement by foreign forces," the embassy said.
On Saturday, Putin and German Chancellor Angela Merkel at talks in Moscow threw their weight behind the Berlin conference being organised by UN special envoy Ghassan Salame that could be held in the coming weeks.
Putin on Saturday again denied Russia had deployed mercenaries to Libya.