US allies are fighting each other in northern Syria. Here’s why.

The United States’ attempts to bring together bitter enemies to tackle the Islamic State in Syria are unraveling, as Washington’s key partners turn their guns on each other.

Over the past few days, Syrian rebels backed by the Turkish military have clashed with Kurdish fighters inside Syria. That’s thrown into chaos an anti-ISIS alliance that includes all of the above, and is led by US forces.

Turkey sent tanks, artillery and planes into Syria last week in support of the rebels in order to drive ISIS from the border town of Jarablus. The US endorsed the mission and provided drones for surveillance and aerial support.

But the operation appears to be going in a different direction from the one the US had hoped. Turkish-backed forces are mostly focusing on attacking a Kurdish-dominated alliance with Arab fighters called the Syrian Democratic Forces, south of the town.

An intervention the US initially welcomed now seems like it could benefit ISIS, in the short term, by setting the extremist group’s enemies against each other.

Turkish airstrikes have blasted Kurdish-held areas east and west of the Euphrates River, and helped the Turkish-allied Syrian rebels advance.

The Syrian Observatory for Human Rights, a monitoring group based in Britain, said at least 40 civilians were killed in Turkish shelling and airstrikes on Sunday. Officials in Turkey’s capital Ankara rejected the claim.

Turkey, meanwhile, said it killed 25 Kurdish “terrorists” in strikes on Sunday. A day earlier, a Turkish soldier was killed in what Turkey said was a rocket attack by the Syrian Kurdish People’s Protection Units, or YPG.

Read more: Turkey sends more tanks into Syria to fight ISIS — and to block US-backed Kurds

Militias aligned with the Syrian Democratic Forces said Kurdish fighters had left the area Turkey was targeting. Ankara denies the claim.

The Pentagon condemned the “unacceptable” clashes on Monday and called on the combatants to de-escalate.

A US military spokesman for the anti-ISIS coalition told PRI that its forces were not involved in operations against Kurdish forces.

“We want to make clear that we find these clashes unacceptable and they are a source of deep concern. Our forces are not involved in these activities, they were not coordinated with US forces, and we do not support them,” the spokesman said. (A similar statement was later tweeted out by Brett McGurk, US special envoy for the fight against ISIS.)

“We find these clashes unacceptable. … Our forces are not involved,” says a US military spokesman.

The fighting comes when the US and Russia say they’re working toward an end to Syria’s more than five and half years of civil war. But Russia — together with Iran — backs Syrian President Bashar al-Assad. The US and allies have supported various forces opposing him.

In the battle against ISIS, however, the US has cobbled together an unlikely array of proxies and partners to tackle the group.

US fighter jets take off from an airbase in Turkey to bomb ISIS strongholds in Syria and Iraq — and to provide air support for the very Kurdish fighters that Turkey is now targeting. Washington and Moscow are talking about cooperating and sharing intelligence to better target ISIS.

But even when faced with an enemy as loathed as ISIS, not everyone can get along.

Although they share an enemy in ISIS, Syria’s Kurds and Ankara dislike each other almost as much. Turkey claims that the YPG in Syria is part of the Kurdistan Workers’ Party, or PKK, which is considered a terrorist organization by Turkey, the European Union and the US.

Turkey is fighting a bitter conflict against the PKK in Turkish cities. The Turkish authorities worry that gains made by Syrian Kurds toward autonomy in Syria would rile Kurdish separatists inside Turkey even more. Its intervention in Jarablus aimed at preventing Kurdish forces from grabbing sizable land along the border.

Syrian Kurds see Turkey as an abuser of Kurdish rights, and a barrier to their aspirations of greater autonomy.

Read more: Daraya, a symbol of the Syrian revolution, surrenders after years of bombs

The US has tried to balance Kurdish aspirations in Syria with Turkey’s concerns, apparently unsuccessfully.

Months ago, Turkey warned that the Euphrates was a red-line it would not allow Syrian Kurdish fighters to cross. When the YPG did cross that line, it was with US support — when the Syrian Democratic Forces captured the city of Manbij from the Islamic State earlier in August.

Just days after a US spokesman for the anti-ISIS coalition celebrated the Kurdish-led capture of Manbij on Twitter, calling the YPG-dominated Syrian Democratic Forces a “stalwart ally,” those same forces were being attacked by Turkey.

The US demand for the YPG to withdraw east of the Euphrates was seen by some as a slap in the face for a group that had spilled blood capturing Manbij.

The YPG has since said it would withdraw, while leaving an allied unit behind in Manbij.

On Monday, a US Defense Department official said “all” Kurdish forces had moved east of the river. But there has so far been no announcement from the YPG.

Turkey has vowed to keep up the pressure until the Syrian Kurdish fighters pull out completely from the area.

“The YPG … needs to cross east of the Euphrates as soon as possible. So long as they don’t, they will be a target,” Turkey’s Foreign Minister Mevlut Cavusoglu said on Monday.

He accused the group of “ethnic cleansing,” by taking control of traditionally Arab areas of northern Syria.

Pentagon spokesman Peter Cook said Monday the US was working to stop the fighting among its allies along the border. He added that the Turkey-US demand for the YPG to retreat east of the Euphrates had “largely occurred.”

If the US can convince the YPG to fully withdraw to the east of the Euphrates, there is a chance that the US may have gained a more committed player in the fight against ISIS in the form of Turkey. If not, a drawn-out conflict between America’s allies could allow ISIS time to regroup right when it’s being squeezed on all sides.