Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.

For months, there have been warnings that the Islamic State's eventual defeat in Iraq and Syria would only spark a number of far more complicated and arguably more dangerous conflicts. We may now be seeing the first of those conflicts erupt in northern Iraq, where two close U.S. allies have commenced combat over the future of the nation.

Adding to the dangerous mix is the alleged involvement of Iranian-backed militia in the fighting, which comes just days after President Trump singled out Tehran's “destabilizing” activities across the Middle East as he announced his plans to decertify the nuclear agreement with Iran. Any rash decisions on Trump's part could be a boon for exactly the Iranian activities he has denounced.

The dispute is centered around Kirkuk, an ethnically and religiously mixed city in the country's north that straddles Iraq's sectarian lines and sits next to major oil fields. The city had been under the control of Kurdish forces since 2014, when Iraq's national army crumbled in retreat from the Islamic State. Early Monday, Iraqi forces pushed back. The Washington Post's Loveday Morris and Mustafa Salim report that Baghdad-allied troops said they had seized a military base, an oil field and other key infrastructure from Kurdish forces.

Overnight, as those troops approached, there were widespread fears of considerable bloodshed: Kirkuk is home to sizable populations of Kurds, Arabs and Turkmen, and relations among the groups have long been uneasy. In the end, the skirmishes were smaller but still worrying — one video shared online showed a number of dead bodies wearing the uniforms of Kurdish peshmerga soldiers. "This is the result of disobedience of Masoud Barzani," the Iraqi fighter who was filming said, referring to the leader of Iraqi Kurdistan.

But there are concerns that the battles could be a prelude to greater violence if the two sides don't de-escalate — a situation that would force the United States to make some awkward choices about whom it should back if push really comes to shove.

It's startling how quickly things have deteriorated. Just a few months ago, the Defense Department said the level of cooperation between the Iraqi government and the Kurdish Regional Government was “unprecedented,” dubbing the peshmerga a “critical partner in counter-ISIS operations.”

Then came the independence referendum that Barzani held on Sept. 25, in which almost 93 percent of Iraqi Kurds voted to break away. The referendum did not have the backing of Baghdad, and most of the international community — including the United States, normally a staunch Kurdish ally — opposed the referendum on the grounds that it undermined Iraqi statehood. Iraq's neighbors were furious about the vote, which seemed to embolden claims for statehood among their own Kurdish minorities. Iran in particular seemed incensed, given the close ties between Iraqi and Iranian Kurds.

But the dream of independence has long been held by Iraq's Kurdish minority, who suffered terribly under the regime of Saddam Hussein. The gains in territory controlled by Kurdish forces after 2014 — in particular, Kirkuk, which has been described as a “Kurdish Jerusalem” — had made that dream seem more urgent and economically feasible.

The ease with which Iraq took back Kirkuk on Monday shows that the Kurds' gamble did not pay off. Crucially, the weak resistance put up by Kurdish forces points to the political divisions within Kurdish society. Responding to reports that some soldiers had been ordered to withdraw, the Peshmerga General Command, aligned with Barzani and the ruling Kurdistan Democratic Party, accused officials from the rival Patriotic Union of Kurdistan party of aiding “the plot against the people of Kurdistan,” the BBC reports.

A number of observers also criticized Iraqi Prime Minister Haider al-Abadi for being too quick to resort to force — and possibly at the behest of Iran, which is an ally of the Shiite-dominated government in Baghdad. “Manipulated by Suleimani's war drum rhythms, Baghdad decided to cross line for short term gain,” tweeted analyst Nibras Kazimi, referring to Iranian Major General Qasem Soleimani, the head of the notorious Quds Force of Iran's elite Revolutionary Guard.

There are many ways in which Iran gains from the current situation. Not only does the conflict undermine Kurdish unity, it also bolsters the role of Iranian-aligned militias in Iraq and makes them look like guardians of national unity rather than sectarianism. It also puts the United States in an awkward position, running the risk of either undermining Abadi if it criticizes the Iraqi government too openly or supposedly betraying the Kurds and siding with Tehran if it does not.

Despite all the harsh words Trump had for Iran — the Revolutionary Guards in particular — on Friday, he has avoided taking an overt stance on the situation in Kirkuk. “We don’t like the fact that they’re clashing,” Trump said during a news conference Monday. "We never should have been there," he added, referring to the 2003 U.S. invasion, "but we’re not taking sides."

Such a cautious response isn't typically Trumpian, but it's not necessarily a bad thing. It is certainly in the American interest to de-escalate the situation. Doing so will require nudging Baghdad and Irbil towards negotiations as well as dealing with burgeoning inter-Kurdish rivalries. Some of this is already happening, it appears: Washington is considering halting its train-and-equip program for Iraqi forces if the offensive against Iraqi Kurds continues, according to Defense News.

But if Trump changes tack and decides to pick a side — as some high-profile names have said he should — he will put at risk at least one key relationship for the United States and play into Iranian hands. The “art of the deal” president may instead need to go for something that's not his normal approach: a deal that leaves all sides satisfied.

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today's WorldView newsletter.