When Syrian rebels seized the border post at Ras al-Ayn on Nov. 8, they celebrated the victory and went on to "liberate" the town, a place where both Arabs and Kurds live on Syria's northeast border with Turkey.
But the Kurdish inhabitants quickly saw their "liberation" as a disaster. Within days, dozens were dead in clashes between Kurdish militias and the rebels.
Many civilians in Ras al-Ayn fled to neighboring Turkey. Kurds on both sides of the border blamed the Turkish government for arming the rebels and backing the operation.
Ras al-Ayn was pitched into a crisis that threatened to open new and dangerous ethnic tensions between the mostly Arab rebels and Syria's Kurds. There are now jittery Kurdish towns and villages across northeastern Syria, where the minority Kurdish population is concentrated.
Now, there's a deal on the table to end the fighting between the rebels and the Kurds. The resolution could say a lot about how the revolt against President Bashar Assad's regime plays out in one strategic corner of the country.
"I make no predictions in what will happen," says analyst Joost Hiltermann, with the International Crisis Group and an expert on Kurdish politics. "These populations have lived side by side for a long time, but when you lift a lid off of a country, as the case in Syria, anything can happen."
The two rebel brigades that came to Ras al-Ayn are from the Salafist wing of Syria's armed groups. Both brigades, the Strangers of Damascus and the Al Nusra Front, are considered experienced fighters.
They quickly routed the Syrian army, but proved to be inept politicians when it came to dealing with the suspicious Kurds of Ras al-Ayn. The rebels immediately banned the Kurdish flag, reportedly burned down the local liquor shop, or smashed the bottles, depending on who is telling the story, and ordered the Kurdish militias to turn over their weapons.
The rebels also challenged Syria's most powerful Kurdish group, the Democratic Union Party, known as the PYD, which has tightened its control over many of Syria's Kurdish towns and villages as the Syrian regime's control has contracted.
Armed Kurdish reinforcements started pouring in to Ras al-Ayn. The PYD was not about to turn over the town to the rebels, a mostly Arab fighting force, and certainly not to Islamist militants.
For now, at least, the various factions seem to have pulled back from the brink of a full-scale confrontation.
According to sources who worked on the negotiations, the plan to resolve the conflict includes a 15-member civilian council for Ras al-Ayn, which includes four Arabs, six Kurds, and representatives of other minorities.
The rebels are slated to control the border post outside the city, but all armed groups will stay outside Ras al-Ayn. No weapons are allowed inside the town. There is a tense truce as both sides consider their options.
The civilians have been seen entering the city again, but mostly on quick trips to pick up whatever belongings they can carry. There is not enough trust yet to return to Ras al-Ayn.