By Laila Bassam and Tom Miles

BEIRUT/GENEVA (Reuters) - Russia's military intervention in the Syrian war has all but destroyed a deal agreed last month to halt fighting between warring sides in two areas of the west, unpicking a rare success for foreign-backed diplomacy in the four-year-long conflict.

Implementation of the deal agreed with U.N. help to extricate rebels from the town of Zabadani and trapped villagers from al-Foua and Kefraya has effectively been shelved following Russian air strikes in support of President Bashar al-Assad, three sources familiar with the talks told Reuters.

While local ceasefires in both locations continue to hold, this means it may be only a matter of time before fighting there resumes between insurgent groups on the one hand, and the Syrian military and its Lebanese ally Hezbollah on the other.

The bleak outlook for the deal fits into a broader picture of escalation, as deepening foreign involvement further complicates a conflict that has already killed 250,000 people and shattered a nation.

The deal brokered with Iranian and Turkish help followed a weeks-long offensive by the Syrian military and Shi'ite Islamist Hezbollah to capture the town of Zabadani near the Lebanese border from insurgents who are still holed up there.

The rebels including the Sunni Islamist group Ahrar al-Sham and the al Qaeda-linked Nusra Front had been waging a parallel attack on Kefraya and al-Foua, two Shi'ite villages in the northwestern province of Idlib.

"There's a ceasefire now but that’s about it. The deal has become another victim of the Russian escalation. People have forgotten about implementation," said a person with knowledge of the negotiations.

Two senior regional officials with knowledge of military and political developments in Syria and close to its government meanwhile said a ground offensive by the Syrian army and its allies, backed by Russian air strikes had rendered the agreement irrelevant.

"The agreement has fallen. Kefraya and al-Foua are out of the race. The Russian-Iranian alliance is determined to liberate Idlib. And thus Kefraya and al-Foua ... will fall on the way," said one of the officials, who has close ties to Damascus.

Story continues

"SURGING MILITARY ACTIVITY"

The other official said: "The attack that started in the Hama countryside in the direction of Idlib will certainly lead to the liberation of Kefraya and al-Foua and thereby negating the real reason of the agreement."

Their comments point to increased confidence on the side of the Syrian government and its allies and their belief in the possibility of a military victory over insurgents in western Syria, the main focus of Russia's air strikes.

An official from Ahrar al-Sham said the group was currently not commenting to the media about the agreement.

But the rebels are hoping Russia's intervention will lead to increased military support from their own foreign backers, particularly Sunni Saudi Arabia, which is locked in a struggle for influence across the region with Shi'ite Iran.

Backed by Russian air strikes, the Syrian army and allies including Hezbollah this week launched new ground offensives against insurgents in two strategically important areas of Hama province this week.

The Syrian Observatory for Human Rights, a Britain-based organization that tracks the war using sources on the ground, said on Friday they had yet to make significant territorial gains in those areas.

The success of the U.N.-backed negotiations had offered a rare ray of hope in the war where diplomacy has mostly made no headway.

Iran had negotiated on behalf of the Syrian government and Hezbollah. Ahrar al-Sham, one of the most powerful rebel groups in Syria, had secured a mandate to negotiate on behalf of a range of insurgent groups.

The talks took place in Turkey, one of the states that supports the insurgents fighting Assad.

The United Nations said on Oct. 2 it had been forced to suspend planned humanitarian operations in Syria under the ceasefire agreement due to "a surge of military activity". Initial steps had included evacuations of wounded.

The office of U.N. envoy for Syria Staffan de Mistura at the time called on the parties to fulfill their responsibilities and to reach necessary understandings to implement the agreement.

De Mistura's spokeswoman said on Friday the United Nations was ready to support implementation of the deal "once the final agreement of all the parties is received for the launch of the operation".

(Writing and additional reporting by Tom Perry; Editing by Anna Willard and Alison Williams)