Turkey's military launched a cross-border operation against Kurdish-led forces in Syria in early October, after US troops who had been allied to the Kurds withdrew.
After four days of fighting, the Kurds agreed a deal with the Syrian government for the Syrian army to be deployed on the border to help repel the Turkish assault.
These maps help explain the offensive and what is happening on the ground.
Who are the Kurds?
Between 25 and 35 million ethnic Kurds inhabit a mountainous region straddling Turkey, Iraq, Syria, Iran and Armenia. But they have never had a widely-recognised permanent nation state of their own.
Kurds make up between 7% and 10% of Syria's population. For decades, they were suppressed and denied basic rights by President Bashar al-Assad and, before him, his father Hafez.
Before the uprising against Mr Assad began in 2011 most Kurds lived in the cities of Damascus and Aleppo, and in three northern areas near the Turkish border - Afrin in the west, Kobane (Ain al-Arab) in the centre, and Qamishli in the east.
When the uprising evolved into a civil war, the main Kurdish parties avoided taking sides. In 2012, government forces withdrew from Kurdish areas to concentrate on fighting rebel factions elsewhere, and Kurdish militias took control in their wake.
In late 2014, the jihadist group Islamic State (IS) launched an assault on Kobane. The battle sparked alarm across the world and a US-led multinational coalition against IS intervened by carrying out air strikes. After the militants retreated, the Kurds became the coalition's most critical partner on the ground in Syria.
The biggest Kurdish militia, the People's Protection Units (YPG), formed an alliance with local Arab militias called the Syrian Democratic Forces (SDF) in 2015. With the help of coalition airpower, weaponry and advisers, SDF fighters drove IS out of a quarter of Syria and captured its last pocket of territory in the country in March 2019. They also set up an "autonomous administration" to govern the region.
Why did Turkey launch an offensive?
Turkey had long threatened to launch an operation in SDF-held territory to create a 32km (20-mile) deep "safe zone" running for 480km (300 miles) along the Syrian side of the border.
It wants to push back members of the YPG, which it views as an extension of a Kurdish rebel group that has been fighting in Turkey for decades and is designated a terrorist organisation - the Kurdistan Workers' Party (PKK). Turkey also hopes to resettle, in the zone, up to two million of the 3.6 million Syrian refugees it is hosting.
In an attempt to avert an offensive, the US and Turkish militaries agreed in August to set up a "security mechanism" on the Syrian side of border – an area that would be free of YPG fighters, but pointedly avoided using the term "safe zone". US and Turkish troops carried out joint patrols in the area and the YPG co-operated, withdrawing fighters and heavy weapons and dismantling fortifications.
But on 6 October, Turkish President Recep Tayyip Erdogan told US President Donald Trump that a cross-border operation would "soon be moving forward", according to the White House. Mr Trump responded by saying US troops based in the area would not support or be involved in the operation, it said.
Three days later, Mr Erdogan announced the start of "Operation Peace Spring" by the Turkish military and allied Syrian rebel factions. He said they aimed "to prevent the creation of a terror corridor across our southern border, and to bring peace to the area".
The SDF said it was determined to defend its territory "at all costs", but Turkish-led forces were able to steadily push their way into a sparsely populated, mostly Arab area between the towns of Tal Abyad and Ras al-Ain in the first five days of the assault. Turkish air and artillery strikes affected a much larger area, including predominantly Kurdish towns and villages to the west and east.
Amid growing chaos, US officials said on 13 October that Mr Trump had decided to begin withdraw all its troops from northern Syria.
Hours later, the SDF said an agreement had been reached with the Syrian government - which considers the US an enemy - for the Syrian army "to enter and deploy along the length of the Syrian-Turkish border" and repel the Turkish assault.
What has been the humanitarian impact?
The area falling within Turkey's "safe zone" is fertile plain that once served as Syria's breadbasket. It is dotted with dozens of villages and towns, unlike the barren, desert regions to the south.
When the Turkish offensive began, the UN said the potentially affected area included SDF-controlled territory that was home to 2.2 million people, including 1.3 million in need of humanitarian assistance, and two government-controlled cities where 450,000 people live - Qamishli and Hassakeh.
By 13 October, air strikes, shelling and fighting on the ground had reportedly killed dozens of civilians and forced more than 150,000 others to flee their homes.
The UN said most of the displaced were from the towns of Ras al-Ain and Tal Abyad, which were the initial targets of the Turkish assault.
Some 5,000 internally displaced people (IDPs) living at the Mabruka camp, west of Ras al-Ain, had to be evacuated towards Hassakeh city after the surrounding area came under artillery fire on 10 October.
Could detained IS fighters and their families escape?
The UN also expressed grave concern for the population of the two IDP camps at Ain Issa, south of Tal Abyad.
The area around the camps was hit by shells on 13 October as Turkish forces advanced, prompting some of the 13,000 residents to flee, it said. SDF officials reported that dozens of women and children being held at the camps because of suspected links to IS, including British nationals, were among those who fled.
Meanwhile, there were reports of unrest at al-Hol camp, which is about 60km from the Turkish border and so would not be in Turkey's proposed "safe zone".
Some 68,000 people linked to IS are being detained al-Hol. More than 94% of them are women and children, and 11,000 are foreign nationals.
The SDF says it is also holding more than 12,000 men suspected of being IS members in seven prisons. At least 4,000 of the prisoners are foreign nationals.
Some of the prisons are in areas close to the Turkish border, including Ain Issa, Qamishli and Derik.
On 11 October, the SDF said five IS militants had escaped from a prison in Qamishli after Turkish shelling nearby and that a car bomb had exploded next to the wall of a prison in Hassakeh, causing damage.
Mr Trump told Mr Erdogan before the offensive that Turkish troops would be responsible for securing detained IS fighters in areas they captured. The SDF has said its fighters will continue to guard the prisons and camps, but there is a concern they could be called away to other areas or be forced to flee if attacked.