Kurdish-led forces in Syria have struck a deal with Bashar al-Assad’s government to hand over areas along the border to the Syrian army in a last ditch effort to halt a Turkish attack.

The Kurdish-led Syrian Democratic Forces, one of the west’s key allies in the fight against Isis, said the army would deploy along the border with Turkey “to repel this aggression and liberate the areas entered by the Turkish army and its hired mercenaries”.

The deal was struck in response to a wide-scale military operation launched by Turkey against the SDF last week, which has killed more than 60 civilians and sparked fears of ethnic cleansing.

Turkey’s armed forces and allied Syrian rebels have made rapid gains in the past week, taking control of two cities along the border and threatening to advance further. General Mazloum Kobani Abdi, commander of the SDF, described the operation as an “existential threat” to Syria’s Kurds.

The agreement could spell the end of a years-long experiment in autonomy led by Syria’s Kurds, and marks a major shift in alliances for the embattled community.

Turkey launches offensive into Syria Show all 25 1 /25 Turkey launches offensive into Syria Turkey launches offensive into Syria Turkish soldiers with armored vehicles EPA Turkey launches offensive into Syria A woman flees with her children during Turkish bombardment on Syria's northeastern town of Ras al-Ain AFP/Getty Turkey launches offensive into Syria Smoke billows following Turkish bombardment on Syria's northeastern town of Ras al-Ain in the Hasakeh province along the Turkish border on October 9, 2019. - Turkey launched an assault on Kurdish forces in northern Syria with air strikes and explosions reported along the border. President Recep Tayyip Erdogan announced the start of the attack on Twitter, labelling it "Operation Peace Spring". (Photo by Delil SOULEIMAN / AFP) (Photo by DELIL SOULEIMAN/AFP via Getty Images) DELIL SOULEIMAN AFP/Getty Turkey launches offensive into Syria The first group of Turkish infantry prepare to enter Syria on the border Getty Turkey launches offensive into Syria Civilians flee AFP/Getty Turkey launches offensive into Syria Smoke billows from targets inside Syria AP Turkey launches offensive into Syria Turkish armoured vehicles enter Syria in Akcakale Getty Turkey launches offensive into Syria Civilians leave as smoke rises from Ras al-Ain AFP Turkey launches offensive into Syria A multi-rocket launcher fires in an unknown location Turkish Defence Ministry via Reuters Turkey launches offensive into Syria People wave as Turkish soldiers prepare to cross the border Getty Turkey launches offensive into Syria Girls stand together in Ras al Ain town Reuters Turkey launches offensive into Syria A woman walks as smoke billows following Turkish bombardment in Syria's northeastern town of Ras al-Ain AFP/Getty Turkey launches offensive into Syria A Turkish army's tank drives down from a truck towards the border with Syria AFP/Getty Turkey launches offensive into Syria Turkish jet taxis on tarmac after returning to a military base in southeast Diyarbakir Reuters Turkey launches offensive into Syria A Turkish armored vehicle drives down a road during a military operation in Kurdish areas of northern Syria EPA Turkey launches offensive into Syria People sit on belongings at a back of a truck as they flee Ras al Ain town Reuters Turkey launches offensive into Syria Turkey-backed Syrian opposition fighters enter Tel Abyad AFP/Getty Turkey launches offensive into Syria Civilians flee AFP/Getty Turkey launches offensive into Syria People flee Tal Abyad North Press Agency/Reuters TV Turkey launches offensive into Syria People wave as Turkish soldiers prepare to cross the border into Syria Getty Turkey launches offensive into Syria Civilians flee with their belongings AFP/Getty Turkey launches offensive into Syria Civilians flee during Turkish bombardment on Syria's northeastern town of Ras al-Ain in the Hasakeh province along the Turkish border on October 9, 2019. - Turkey launched a broad assault on Kurdish-controlled areas in northeastern Syria today, with intensive bombardment paving the way for an invasion made possible by the withdrawal of US troops. (Photo by Delil SOULEIMAN / AFP) (Photo by DELIL SOULEIMAN/AFP via Getty Images) DELIL SOULEIMAN AFP/Getty Turkey launches offensive into Syria Turkish President Recep Tayyip Erdogan, right, speaks with Defense Minister Hulusi Akar, left, as they watch the operation by Turkish forces in Kurdish areas EPA Turkey launches offensive into Syria Smoke rises from the Syrian town of Tal Abyad AFP/Getty Turkey launches offensive into Syria Turkey-backed members of Syrian National Army prepare for moving to Turkey with heavy armed vehicles EPA

Turkey has long threatened to attack the SDF, which it considers a terror organisation for its links to a Kurdish separatist group that has fought the Turkish state for decades. Ankara said its military operation was launched to implement a “safe zone” along its border with Syria, free of SDF fighters.

But the SDF – a mostly Kurdish militia with a smaller Arab contingent – has been a key ally of the US in the fight against Isis. The presence of US troops in Syria alongside the group had acted as a deterrence for a Turkish assault. That changed quickly last week when Donald Trump made a shock announcement that the US would not stand in the way of Turkey’s plans to enter Syria. The SDF described the abrupt shift as a “stab in the back”.

The deal will see the Syrian army deployed along a large stretch of the Turkey-Syria border, the SDF said, in an effort to deter any further Turkish incursion.

The agreement brings its own dangers, however. For decades, Kurds in Syria have faced repression and discrimination at the hands of the government. Although the civil war had caused great upheaval for the community, it has also allowed them to win new freedoms, which may now be lost again.

The SDF currently controls around a third of Syrian territory in the north and east of the country.

Syria’s Kurds took over control of majority Kurdish areas from the government shortly after the outbreak of Syria’s civil war in 2011, but largely refrained from directly fighting it.

In the time since, it extended that area of control beyond Kurdish areas as it recaptured territory held by Isis.