Iraqi security forces in eastern Ramadi on Thursday. The fall of the city is a bleak symbolic defeat for the Iraqi government and its allies, including the United States. Photograph: AP

Over the weekend, as ISIS fighters rolled into Ramadi, the capital of Iraq’s Anbar Province, one of them posted a video to the Internet. It was shot from a recently captured Iraqi police station, and showed box after box of American mortar shells and bullets that appeared shiny and new. Several Humvees, apparently not long out of the packing crates, sat abandoned nearby. “This is how we get our weapons,” the narrator said in Arabic. “The Iraqi officials beg the Americans for weapons, and then they leave them here for us.”

Depressing, isn’t it? The fall of Ramadi is not just a bleak symbolic defeat for the Iraqi government and its allies, including the United States. During the nearly nine years that American troops fought in Iraq, Anbar Province was one of the most lethal places for American soldiers and Marines; some thirteen hundred died there. In 2008, though, when the Americans finally handed the city back to the Iraqi Army, many of the American Marines present at the ceremony there were not even carrying weapons. After so much bloodshed, Ramadi had become one of the safest cities in the country.

All of that is gone now. Along with the western half of Mosul, which ISIS captured last summer, Ramadi represents the second pillar of the group’s Iraqi domain. To the west, the Islamic State, as the group calls itself, stretches across the Syrian border and up the Euphrates River, all the way to the suburbs of Damascus. Ramadi’s fall underscores just how troubled the American-backed campaign against ISIS is; increasingly, it seems, the effort to defeat the group is colliding with the very nature of what Iraq and Syria are—or, more accurately, what they are not.

In the past several months, there have been hopeful moments. In March, the Iraqi Army recaptured Tikrit, an important provincial capital, behind a barrage of American airstrikes. Last week, an airstrike appears to have killed Abu Alaa al-Afari, who had assumed substantial control of ISIS following the wounding of Abu Bakr al-Baghdadi, ISIS’s founder. Over the weekend, on orders from President Obama, a team of American commandos moved into Syria and killed Abu Sayyaf, an ISIS leader who oversaw the group’s oil-smuggling operations, one of its many money streams. These events appeared to set the stage for a much-anticipated operation to retake western Mosul, which Iraqi and American officials said would get under way this summer. When Iraqi Prime Minister Haider al-Abadi visited the White House last month, American officials were so encouraged by the progress that they bestowed another two hundred million dollars or so on the Iraqi government. (The U.S. has spent about $1.9 billion on military operations and hardware in Iraq and Syria in the most recent operations.)

What happened in Ramadi over the weekend revealed just how misplaced any optimism about Iraq really is. The town, dominated by members of Iraq’s Sunni minority, was largely being held by the Iraqi Army, which has proved to be a deeply fractured and incompetent institution. Last June, when ISIS first swept out of Syria and into northern Iraq, the Iraqi Army largely disintegrated. Since then, the focus of American efforts has been to rebuild the Army and turn it into an effective fighting force. Even by American assessments, this is a long-term project. The disaster in Ramadi proved just how difficult the challenge is.

And then there is the loss of Ramadi itself. Without it, most of Anbar’s populated areas are now in ISIS’s hands. (Fallujah has been under ISIS control since last year.) The big airbase at Al Assad, which was the center for much of the Iraqi Army’s (and American) operations, is now cut off in the desert. “The fall of Ramadi is a game-changer,” Jessica Lewis McFate, the head of research at the Institute for the Study of War, which released a detailed report on the war just before Ramadi’s fall, said. “Whatever confidence remained in the Iraqi security forces is likely to collapse.”

In Baghdad, Prime Minister Abadi faces a stark choice: losing Anbar Province to ISIS or unleashing Shiite militias to reconquer the place, only to permanently alienate an occupied Sunni population. The militias, some of which were responsible for widespread atrocities during the Iraqi civil war between 2005 and 2008, are generally much more effective than the Iraqi Army. Despite their success, American officials are deeply worried about the prospect of the Iraqi security forces being completely taken over by gangs of Shiite gunmen, and they have leaned on Prime Minister Abadi to keep the militias out of Ramadi. For one thing, the militias are trained and backed by Iran, whose influence, despite the country’s desire to crush ISIS, often runs directly against that of the United States. During the American war in Iraq, those same Shiite militias, under Iranian direction, killed hundreds of Americans soldiers.

But the most important reason the Americans are opposing the use of Shiite militias to help regain control of Anbar Province is that they don’t want the campaign against ISIS to become an entirely sectarian war.

And that’s the central conundrum of the campaign against ISIS. The two countries whose territory ISIS has captured, Iraq and Syria, are embroiled in conflicts that are almost entirely demarcated by religion. In Iraq, it’s Sunni vs. Shiite vs. Kurd (most Kurds are Sunnis, so there’s an ethnic element to the struggle there). In Syria, the Sunni opposition, dominated by ISIS and the Al Qaeda franchise Jabhat al-Nusra, is facing off against a government dominated by an Alawite minority. In Iraq and in Syria, the only effective fighting forces—on either side—are based in sect or ethnicity.

What happens now? Under intense pressure from Iraq’s Shiite politicians (he is one himself), as well as from the Iranians, Abadi appears to be preparing to send in the militias. The results will not be pretty.

Since the end of the First World War, both Iraq and Syria have been artificial states, drawn from the ruins of a fallen empire with little regard for sect, tribe, or ethnicity. At best, those artificial states could hope for a day when their people would set aside their more primal loyalties in favor of a broader sense of nationhood. Today, as both Iraq and Syria writhe in sectarian conflicts, the sense of nationhood that could bind those states together seems as elusive as it’s ever been.