BEIRUT/ISTANBUL (Reuters) - Russia intervened to halt a clash between Syrian government forces and Turkey-backed Syrian rebels in northern Syria, sources on both sides said on Friday, the first confrontation between them as both sides fight Islamic State in the area.

Rebel fighters gather around a pick-up truck carrying food on the outskirts of the northern Syrian town of al-Bab, Syria February 8, 2017. REUTERS/Khalil Ashawi

Islamic State is under attack from separate campaigns in northern Syria by Russian-backed government forces and Turkey-backed rebels. The clash on Thursday near the IS-held city of al-Bab underlined the risk of the parallel offensives igniting new fighting between the government and its rebel enemies.

Russia and Turkey have backed opposing sides in the war but recently started cooperating over Syria, brokering a truce between government forces and rebels and working together to try to revive peace talks.

Rebel officials said the clash took place in a village southwest of al-Bab. An official in a military alliance fighting in support of the Syrian government confirmed a clash had taken place. “The Russians intervened to control the situation,” said the source, speaking on condition of anonymity.

President Bashar al-Assad is supported in the war by the Russian military and an array of Iranian-backed militias.

Two rebel officials accused the government forces of provoking the incident. One of them said the government forces had moved towards their positions in tanks. “Rebels shot to warn them not to get any closer, but the tank responded and a clash erupted,” said the first rebel official.

“Later on Russia intervened to calm down the situation,” said the rebel official. “This whole incident felt like a test.”

A second rebel official, a commander in the al-Bab area, added: “They opened fire. Fire was returned.”

Both rebel officials said an armored vehicle had been captured from the government forces.

There was no immediate comment from Russia.

Russian air strikes accidentally killed three Turkish soldiers on Thursday in northern Syria. It was not immediately clear whether the confrontation described by the sources had taken place in the same area as the air strike.

Turkey and its FSA rebel allies have carved out a de facto buffer zone in northern Syria in territory captured from Islamic State since August in their “Euphrates Shield” operation. They have been battling to capture al-Bab since December, but escalated their attack this week, seizing the city’s outskirts.

The Syrian army meanwhile mounted its own, rapid advance towards the city in the last few weeks, advancing to within a few kilometers (miles) of its southern outskirts.

Turkish Prime Minister Binali Yildirim said earlier this week that clashes with the Syrian forces had been avoided thanks to international coordination, including between Turkey and Russia.

The Kremlin said on Thursday that Russian President Vladimir Putin had called Turkish President Tayyip Erdogan and expressed his condolences over the air strike, blaming the incident on poor coordination between Moscow and Ankara.

The Kremlin spokesman said on Friday the air strikes were based on coordinates provided to Russia by the Turkish military..