Fighters in eastern Libya loyal to renegade military commander Khalifa Haftar have announced a ceasefire in the western region, which includes the capital Tripoli, starting 00:01am on Sunday (22:01 GMT), conditioned on acceptance by their rivals, a spokesman said.

Forces loyal to Haftar have been battling forces aligned with the internationally-recognised Government of National Accord (GNA) - with the aim of capturing Tripoli - since April.

More:

Haftar's self-styled Libyan National Army (LNA) on Thursday rebuffed a call by Turkey and Russia for the warring parties to declare a ceasefire amid clashes and air raids in a conflict drawing increasing foreign involvement and concern.

However, LNA spokesman Ahmed Mismari said in a video statement late on Saturday that the LNA accepted a truce in the west "provided that the other party abides by the ceasefire."

He warned that "any breach will be met with a harsh response".

Al Jazeera's Mahmoud Abdelwahed, reporting from Tripoli, said the fact that the warring factions agreed to a ceasefire did not mean an end to hostilities.

"[This is] especially with the UN-recognised government demanding that Haftar's forces pull out from southern Tripoli as a prerequisite to any settlement in this conflict," he said.

The United Nations Support Mission in Libya (UNSMIL) welcomed the truce and urged the warring parties "to strictly abide by the ceasefire and make a room for peaceful efforts to address all disputes through a Libyan-Libyan dialogue".

Turkey backs the Tripoli-based GNA headed by Fayez al-Sarraj, while Russian military contractors have been deployed alongside the eastern forces.

'International unity needed'

Anas El Gomati, an analyst working on Libya, told Al Jazeera that the international community needed to find a unified position over the deadly conflict.

He said: "When we think that there is so much disunity in the international community, they have to have a conference about finding a unified position amongst themselves before they can even bring Libyans to the table. That's the main issue here."

A senior GNA official said on Thursday that it welcomed any credible ceasefire proposal but had a duty to protect Libyans from Haftar's offensive.

Any ceasefire will probably be hard to uphold after a recent escalation in fighting around Tripoli and the strategic coastal city of Sirte, and given the fractious, loose nature of Libya's military alliances.

Forces loyal to Haftar said this week they had taken control of Sirte in a rapid advance preceded by air raids.

Earlier on Saturday, German Chancellor Angela Merkel said Libyan peace talks would be held in Berlin, adding that Libya's warring parties would need to play a major role to help find a solution.