Last Wednesday was a strange and scary day in Syria, even by Middle East standards. In the early afternoon, American military commanders, nearly victorious against Daesh (ISIS), were standing at a hilltop observation post here complaining about harassing fire on their Syrian Kurdish partners – from a rebel force that is backed by Turkey, our NATO ally.

And then a few hours later, about a hundred miles (around 160 kilometers) to the southeast, ground troops supporting the Syrian regime of Bashar Assad struck a headquarters of Syrian Kurdish fighters and their partners from U.S. Special Operations Forces, five miles east of the Euphrates and possibly near Syrian oil fields. The American-led coalition hit back hard with airstrikes.

The U.S. military wouldn’t provide any details, but Russian forces have been backing the Syrian regime in the Deir al-Zor area. The firefights continued well into the night and could mark a significant escalation of the war here.

Wednesday’s lesson, on both fronts, is that this battle space is way too crowded and slipping dangerously close to a much wider conflict.

America and Turkey have been moving in slow motion toward their collision since the U.S. decided to destroy Daesh 3 1/2 years ago. The only Syrian partners able to do the job were the Kurds, who dubbed themselves the Syrian Democratic Forces. Turkey was furious, claiming that the Kurdish group was “terrorist.”

But Ankara could never offer a credible alternative to conquer Daesh (ISIS), so the U.S. pushed on.

When the Russians entered the fray in 2015, the U.S. tried to establish clear deconfliction lines.

But this has proved a delicate and uncertain business. Those Russia contacts are more essential now than ever.

How can the U.S. untangle this mess, so it can finish the job against Daesh? America needs “dialogue” and “de-escalation” quickly with Turkey, explains Lt. Gen. Paul Funk, the commander of U.S. forces in Syria and Iraq. The campaign against Daesh is “slowing down,” he warns, and the lull could “allow these people to escape” into Turkey and then to Europe.

Funk speaks to reporters here at an outpost manned by the SDF. A mile and a half west, you can see the berm that marks the forward position of the Turkish-backed rebels. About 40 miles farther west is the Kurdish zone called Afrin, which Turkish warplanes and artillery have been pounding since late last month.

U.S. Special Operation Forces have done wonders here, working with the SDF, shattering Daesh control of eastern Syria.

But we’re nearing the end of what military power can do. The next step requires diplomacy. It was encouraging that national security adviser H.R. McMaster headed to Ankara over the weekend.

He would be wise to treat the crisis with Turkey as an opportunity – and start the quiet discussions that could lead to an eventual reconciliation of Turkish and American interests.

Manbij illustrates how the battle against Daesh was turned by the U.S. and its SDF partners – and what post-Daesh recovery looks like.

The sidewalks of Jalla Street in the center of town were so crowded with shoppers Wednesday that it was easier to walk in the road. In a little stall selling men’s cologne, Fawaz al-Khannem remembers that the favorite scent of Daesh fighters was a musky fragrance called “Sultan.”

Inside the covered market, where Daesh once built car bombs, the shops are packed. Women are buying colorful dresses, sparling with sequins, and ripped jeans.

Perhaps the brightest spot in this liberated town is a girls’ school, where students have returned after years in hiding from Daesh. Interrupted in the middle of French class, high-school seniors talk animatedly about their plans. They’re wearing makeup and vibrant clothes; a girl named Aisha is wearing a pink hijab.

Nothing in the Middle East is ever precisely what it appears. Each victory opens the door to a new problem, but no obstacle is quite as insurmountable as the bellicose rhetoric suggests.

Wednesday, as Turkish-backed forces were firing at an SDF checkpoint, scores of trucks were queued up to cross from Manbij into the Turkish-controlled zone.

The Syrian regime allowed Kurdish protesters to traverse regime territory to reach Afrin; later in the day, pro-regime forces were attacking the Kurds elsewhere.

Meanwhile, as Turkish politicians were snarling at America, the Turkish and U.S. militaries continued their regular liaison.

Syrian Kurdish forces have been a brave partner for America, but also an inconvenient one.

Abandoning them would be a bad mistake, but it would also be wrong to let this hydra-headed conflict keep festering.

The U.S. military did its job in Syria. Now it’s time for hard-nosed diplomacy.

David Ignatius is published twice weekly by THE DAILY STAR. A version of this article appeared in the print edition of The Daily Star on February 12, 2018, on page 7.

The views and opinions of authors expressed herein do not necessarily state or reflect those of the Arab Network for the Study of Democracy