A deal between Turkey and Russia has brought an end to a Turkish military operation in north-eastern Syria against a Kurdish-led militia alliance previously allied to the United States.
We've boiled down why it matters.
Turkey considers the biggest militia in the Kurdish-led alliance a terrorist organisation. It says it is an extension of a Kurdish rebel group fighting in Turkey.
On 9 October, Turkish troops and allied Syrian rebels launched an offensive to create a 30km (20-mile) deep "safe zone" along the Syrian side of the border.
It came after the withdrawal of US troops, who had relied on the Kurds to defeat the Islamic State group.
The Kurds asked Syria's government and its ally, Russia, to help stop the assault.
Turkey and Russia subsequently agreed to take joint control of the border area.
Turkey wants to push back from its border members of a Syrian Kurdish militia called the People's Protection Units (YPG).
Turkish leaders view the YPG as a terrorist organisation. They say it is an extension of the Kurdistan Workers' Party (PKK), which has fought for Kurdish autonomy in Turkey for decades.
The YPG dominates an alliance of Kurdish and Arab militias called the Syrian Democratic Forces (SDF), which drove IS out of a quarter of Syria with the help of a US-led multinational coalition.
When the US declared the defeat of IS in March, Turkish President Recep Tayyip Erdogan pushed it to create a "safe zone" clear of YPG fighters in north-eastern Syria where refugees could be resettled.
The US agreed to establish one together with Turkey in August and the YPG complied.
But two months later, US troops pulled back from the border after Mr Erdogan decided to launch an operation to create a 440km-long "safe zone" unilaterally.
The SDF said it had been "stabbed in the back" by the US and warned the defeat of IS might be reversed.
On 9 October, Turkish troops and allied Syrian rebels attacked. Four days later, the SDF turned to the Syrian government and its backer, Russia, for help. They agreed to deploy Syrian soldiers to stop the advance.
The US negotiated a 5-day ceasefire on 17 October to allow YPG fighters to withdraw from a 120km-long stretch of the frontier from Ras al-Ain to Tal Abyad where the fighting was focused.
Just before the ceasefire expired, Mr Erdogan reached a deal with Russian President Vladimir Putin.
They agreed Turkey could keep its forces in the area between Ras al-Ain and Tal Abyad, and that Russian and Syrian troops would take control of the rest of the border.
Why is Turkey worried about Syria's Kurds?
It feels threatened by the People's Protection Units (YPG), the military wing of the Kurdish Democratic Union Party (PYD).
The Turkish government insists the YPG is an extension of the Kurdistan Workers' Party (PKK), which has fought for Kurdish autonomy in Turkey since 1984 and is designated as a terrorist group by the US and EU. The YPG and PKK share a similar ideology, but say they are separate entities.
The YPG is the dominant force in an alliance of Kurdish and Arab militias called the Syrian Democratic Forces (SDF). With the help of air strikes by a US-led multinational coalition against the jihadist group Islamic State (IS), SDF fighters captured tens of thousands of square kilometres of territory in north-eastern Syria between 2015 and 2019.
The SDF set up an autonomous administration to govern the region, home to three million people. It avoided conflict with the Syrian government, but sought recognition for Kurdish autonomy.
Was this Turkey's first cross-border operation?
Despite being a member of Nato and the US-led coalition against IS, Turkey opposed the support the US gave the SDF.
In 2016, the Turkish military supported an offensive by allied Syrian rebel factions that drove IS militants out of the border area around Jarablus and stopped SDF fighters moving west, towards the Kurdish enclave of Afrin.
In January 2018, after US officials said they were helping the SDF build a new "border security force" to prevent IS infiltration, Turkish-led forces launched an operation to expel YPG fighters from Afrin.
What prompted the talk of a 'safe zone'?
Turkish President Recep Tayyip Erdogan has long sought what he has called a "safe zone" clear of YPG fighters in north-east Syria. But the issue came to the fore after the SDF captured the last pocket of IS territory in Syria in March 2019.
In August, the US and Turkey agreed to a "security mechanism" covering a predominantly Arab border area between Ras al-Ain and Tal Abyad.
US and Turkish troops carried out joint patrols and YPG began dismantling fortifications.
But on 6 October, Mr Erdogan told US President Donald Trump that Turkey was about to start a unilateral operation to set up a "safe zone". Mr Trump ordered US troops to pull back from the area.
What was the aim of Turkey's offensive?
At the start of "Operation Peace Spring" on 9 October, Mr Erdogan said Turkish troops and allied Syrian rebels aimed to "neutralize terror threats against Turkey and lead to the establishment of a safe zone, facilitating the return of Syrian refugees to their homes".
SDF commanders warned that a Turkish offensive would "spill the blood of thousands of innocent civilians" and might pave the way for the return of IS.
What was the human cost?
The Syrian Observatory for Human Rights, a UK-based monitoring group, said 120 civilians were killed, along with 275 SDF fighters, 196 Turkish-backed Syrian rebels, 10 Turkish soldiers, and five Syrian soldiers.
President Erdogan said 775 "terrorists" had been "neutralised" and that 79 Syrian rebels and seven Turkish soldiers had been killed. He denied any civilians had been killed in Syria but said 20 had died in YPG attacks on Turkey.
The UN said at least 176,000 people had been displaced by the fighting and that critical civilian infrastructure had been damaged.
How did the offensive end?
After four days of fighting, the US began a full withdrawal from northern Syria and the Kurds agreed a deal with Syrian President Bashar al-Assad's government for the Syrian army to deploy along the northern border for the first time in years to confront the Turkish-led forces. Russia, Mr Assad's staunch ally, sent military police to key locations.
On 17 October, the US persuaded Mr Erdogan to "pause" Turkey's offensive to allow it to "facilitate the withdrawal of YPG forces from the Turkish-controlled safe zone". The ceasefire largely held and on 22 October the head of the SDF said the withdrawal had been completed.
That same day, Mr Erdogan and Russian President Vladimir Putin announced a plan to end the offensive. They agreed:
- Turkish forces would be allowed to remain in the 120km-long strip of territory they had captured between Ras al-Ain and Tal Abyad
- Russian and Syrian troops would take control of the rest of the border area and ensure YPG fighters pulled back 30km from the border
- Turkish and Russian troops would start joint patrols inside a 10km-deep zone along the border on 29 October
There are questions about the deal, such as how long the Turkish forces can stay and what will happen to the tens of thousands of people being detained by the SDF on suspicion of links to IS. But there is no doubt it has cemented Russia's role as the pivotal player in Syria.