“It is perfectly true, as the philosophers say, that life must be understood backwards. But they forget the other proposition: that it must be lived forwards.” This observation was made in 1843 by the Danish philosopher Søren Kierkegaard in a journal entry, but it might have been written about the contemporary Middle East.

We have been living the Islamic State forwards, surprised at every turn, but we can perhaps begin to understand it backwards. Although ISIS took most of the world by surprise when it swept into the Iraqi city of Mosul in June 2014, the group and its forebears had been proclaiming their goals for a decade. Like many consequential events, this one didn’t sneak up on policymakers; they simply didn’t see what was taking shape in front of them. ISIS told us exactly what it was going to do, and then did it. This was a secret conspiracy hiding in plain sight.

ISIS is mysterious in part because it is so many things at once. It combines Islamic piety and reverence for the prophet and his companions with the most modern social-media platforms and encryption schemes; its videos blend the raw pornographic violence of a snuff film with the pious chanting of religious warriors; the group has the discipline of a prison gang (many of its recruits were indeed drawn from U.S.-organized prisons in Iraq), but also the tactical subtlety and capacity for deception of the most skilled members of Saddam Hussein’s intelligence services, who were also pulled into the ISIS net. It appears less brittle than al-Qaeda because its members care less about religious doctrine and organizational hierarchy. As has been said of the Episcopal Church (forgive the comparison), ISIS is solid at the core but loose at the edges.

What is ravaging the Middle East right now is obviously deeper than ISIS. It has become commonplace over the last year to observe that we are witnessing the collapse of the post-Ottoman order—that the “lines in the sand” conjured in 1916 by the British and French diplomats Mark Sykes and François Georges-Picot are being blown to dust. But we haven’t reckoned with how the insurgents perceive that process. ISIS has religious, psychological, and technological faces. But in some fundamental respects it is an anti-colonial movement that takes as its reference point Islam’s pre-colonial conception of power—an Islamic state, a Sunni caliphate. Even if ISIS is crushed, this idea of “our caliphate” is likely to persist, and return.

The story of ISIS teaches the same basic lesson that emerged from America’s other failures in the Middle East over the last decade: Attempts by the United States or Islamist rebels to topple authoritarian regimes—in Iraq, Libya, and now Syria—create power vacuums. This empty political space will be filled by extremists unless the United States and its allies build strong local forces that can suppress terrorist groups and warlords both. When the U.S. creates such local forces, it must be persistent. If it withdraws from these efforts, as America did in Iraq in 2011, it invites mayhem. Halfway American intervention has produced nothing but trouble. Rebels have gotten enough support to continue fighting, but not enough to win.

History teaches that such wars end through a combination of the exhaustion of local combatants and an agreement among major regional and international powers on a formula to curtail the fighting and rebuild some governance. Usually the settlement ratifies the informal cantonal boundaries that have emerged during the fighting, so that each sect has what amounts to a “safe zone” in a decentralized state that functions under the umbrella of the old nation. That’s what happened in Lebanon with the Taif Agreement in 1989, and it’s probably the best that can be hoped for in Iraq and Syria. To reduce human suffering on the way to such a new equilibrium, it’s important, where possible, to back moderate forces as they create the safe zones that will eventually form the pieces of the new federal state—and that provide platforms for attacking extremist groups. Middle Eastern wars rarely end with outright victory and permanent stability, so the word “settlement” may promise too much. At best, for many years, it may simply mean stable ceasefire lines, reduced bloodshed, fewer refugees, and less terrorism.

Ultimately, the errors of judgment that led to ISIS’s rise have been too consequential for any easy prescriptive advice. Instead, I share a comment made to me in June 2003, as this terrible story was beginning, by a Syrian businessman named Raja Sidawi. Here’s a passage from the Washington Post column that quoted my friend’s warning:

“I am sorry for America,” Sidawi said. “You are stuck. You have become a country of the Middle East. America will never change Iraq, but Iraq will change America.” … This tragic sensibility—the sense that in most instances, things do not work out as you might have hoped—is generally lacking in the American character. Americans are an optimistic people: They have difficulty imagining the worst. That was why 9/11 was so shocking. Most Americans never considered that such devastation could be visited on them. Arabs grow up in a culture where it is always best to assume the worst. Sidawi rattled off the list of wars and disasters that have afflicted the Middle East almost continuously since he was born in 1939. That is the bloody history in which America has now enmeshed itself. “You will learn the culture of death,” warned Sidawi.

And so we have.

The Iraqi Roots of ISIS

The Koranic message of submission and jihad is perhaps as powerful now for believers as it was in 622 A.D., when the Prophet Muhammad gathered his followers in Medina and began raiding neighboring areas. The historian Robert G. Hoyland described this ideological spark in his book In God’s Path: The Arab Conquests and the Creation of an Islamic Empire. It’s the same idea that is evoked in the nasheeds, or Islamic chants, that provide the soundtrack for many ISIS videos today: “What is most striking is the very simple but powerful program of action outlined by Muhammad: form a righteous community (umma), go to a safe place (hijra), and from there embark on jihad against the unrighteous,” noted Hoyland.

But religion alone cannot explain the growth of the first caliphate in the seventh century, any more than it can the rapid expansion of the current, self-proclaimed successor caliphate. The spark of jihad ignited and spread so quickly after Muhammad’s death in 632 in part because it fell on the dry tinder of a region enfeebled by imperial wars that had exhausted the Byzantine and Persian Empires.

“The change was so sudden and unexpected that it needs explanation,” wrote Albert Hourani in his landmark study, A History of the Arab Peoples. He noted archeological evidence indicating that the prosperity of the eastern Mediterranean had been undermined by invasions and the loss of agricultural techniques such as terraced farming. It was a region ripe for plunder. “The Arabs who invaded the two empires were not a tribal horde but an organized force, some of whose members had acquired military skill and experience in the service of the empires or in the fighting after the death of the Prophet,” he wrote. (Reading Hourani’s words, I couldn’t help but think of the unlikely contemporary alliance between ISIS religious zealots and ex-Baathists who served in Saddam Hussein’s most secret and brutal units.)

The story of how the forebears of ISIS got started in Iraq is largely the story of a rough-hewn, charismatic al-Qaeda recruit named Abu Musab al-Zarqawi. Back in 2003, observed an anonymous former Western official recently in The New York Review of Books, who “could have imagined that a movement founded by a man [who once worked in] a video store in provincial Jordan would tear off a third of the territory of Syria and Iraq, shatter all these historical institutions and—defeating the combined armies of a dozen of the wealthiest countries on earth—create a mini-empire?”

Zarqawi made his name challenging the grandees of al-Qaeda: the wealthy Saudi businessman Osama bin Laden and the Egyptian doctor Ayman al-Zawahiri. Whereas al-Qaeda’s core leadership planned meticulous, top-down operations, Zarqawi strove instead to emulate the romantic, Crusader-conquering Nur al-Din Zengi, who drove Westerners from Syria.

Convinced the Americans would invade Iraq, Zarqawi began building a base there in 2002; when they did so a year later, he proved willing to ally with remnants of Saddam’s intelligence network. The story is well told by William McCants in his excellent new book, The ISIS Apocalypse. Four months after the U.S. invasion, Zarqawi’s organization attacked three well-chosen targets—UN headquarters in Baghdad, the Jordanian embassy in Baghdad, and the Imam Ali Mosque, a Shiite shrine, in Najaf—that signaled the dirty war ahead. These bombs shattered the ground for reconciliation: Iraq would be a no-go zone for the international organizations that might have lightened the burden of U.S. occupation; Iraq’s links would be severed with its mainstream Sunni patron, Jordan; and Iraq would be cleaved apart by a vicious sectarian war between Sunni and Shiite Muslims, whose coexistence had been a feature of modern Iraqi life. Zarqawi’s game plan was set by late August 2003; at the time, the United States was still denying there was an insurgency in the country.

My recollection of Iraq in late 2003 was of growing violence from Zarqawi’s Sunni insurgency, yes. But even more, I was struck by the desperation of Iraq’s Sunni sheikhs, who feared and in many cases despised the brutal Zarqawi, but couldn’t get tone-deaf U.S. officials in the international Green Zone to take their problems seriously.

Take Fallujah, a sprawling city just west of Baghdad and one of Zarqawi’s early recruiting grounds. Fallujah’s Sunni male residents all seemed to have served in the army or worked as smugglers (or both), and the tribal elders there wanted the United States to provide protection from Zarqawi and a deal that would give the Sunnis a share of the post-invasion spoils. But their pleas were largely ignored. When I visited Sheikh Khamis al-Hassnawi at his villa near the Euphrates River in September 2003, he spoke not only of procuring an American wife (he seemed to have formed his impressions of the U.S. from Baywatch), but also of the dire need for American aid and an ongoing American military presence in the country. “If coalition forces withdraw now, the strong will eat the weak, and people will start killing each other in the street,” he said.

That proved an accurate forecast of what occurred from 2004 on, before U.S. forces embraced a “clear and hold” counterinsurgency policy for Iraq. For the social engineers in the Green Zone, the downtrodden Kurds and Shiites were the instruments for change in the New Iraq. If the Sunnis wouldn’t go along, too bad for them. In this period of growing insurgency and civil war, I remember one prominent U.S. National Security Council official telling me more than once that the answer for Iraq was the “80-percent solution”—in other words, Kurds and Shiites would build the new state regardless of opposition from the 20 percent of the population that was Sunni. This view was recklessness dressed up as realpolitik.

As Zarqawi’s toxic violence escalated, especially toward Shiites, bin Laden and his top deputies became concerned. Zawahiri warned Zarqawi to stop showing beheadings in the videos he posted online. McCants quotes Zawahiri’s admonition that these ultra-violent images might excite “zealous young men” but would appall ordinary Muslims. “We are in a media battle in a race for the hearts and minds of our community,” Zawahiri warned. The message was, in effect: Don’t burn too hot; you’ll burn yourself out.

The hotheads in Iraq didn’t listen, especially when it came to their pet project of declaring an Islamic state in Iraq. Zarqawi’s first discussions of creating a caliphate date back to 2004, according to McCants. Al-Qaeda’s supreme command disagreed; bin Laden felt that moving too soon for power in Iraq and Yemen, the movement’s two strongholds, would lead to premature defeat and tarnish the brand.

U.S. airstrikes killed Zarqawi in June 2006, but his renegade followers nevertheless went on to declare their state, the Islamic State of Iraq, in October 2006, without consulting al-Qaeda leaders. Simultaneously, the sectarian war Zarqawi had launched against the Shiites was proving all too successful. Fifty or more bodies were found every morning in Baghdad; it was said that the Sunnis usually beheaded their victims, while the Shiites drilled holes in their heads. The U.S. government was still in denial; a Washington Post reporter who scouted the morgues to count dead bodies was accused by officials of inflating the numbers.

Over the next two years, however, the prudence of al-Qaeda’s core leaders began to seem warranted. U.S. President George W. Bush embraced General David Petraeus’s “troop surge” and the counterinsurgency philosophy that drove it. A counter-rebellion of Sunni tribal leaders already underway was christened the “Awakening” and received new American money and attention. Tribal fighters and U.S. special-operations forces took the fight ruthlessly to al-Qaeda in Iraq, ignoring its rhetoric about an Islamic state. By 2009, the end of the surge years, the movement Zarqawi had created was all but dead.

But not quite. A few embers of Zarqawi’s Islamic state remained, kept alive by flickering Sunni rage. The flame was nurtured at U.S.-organized Iraqi prisons such as Camp Bucca, where religious Sunni detainees mingled with former members of Saddam’s Baath Party, and the nucleus of a reborn movement took shape.

Did U.S. officials know or care about the fire building beneath the Iraqi state, led at the time by Prime Minister Nouri al-Maliki? Apparently not. Maliki, a Shiite, was proving corrupt and sectarian in his rule, displacing Sunnis from their few handholds of power in the new state. The Iraqi people sensed that Maliki was wrecking their country, and in March 2010 elections voted out his coalition in favor of a more inclusive group headed by the pro-American former Prime Minister Ayad Allawi.

In what can only be described as an act of folly, the United States (with Iran as a silent partner) contrived a horse-trading process that kept Maliki in power. Vice President Joe Biden, who was in charge of the dickering, was fond of proclaiming that “politics has broken out in Iraq.” Iraqi politicians concluded (probably correctly) that the Obama administration had decided to leave the country to its own machinations. Nobody imagined in Washington (and few seemed to understand in Baghdad) that this future would empower as never before the Islamic State.

In the years after Maliki’s 2010 “reelection,” the Islamic State engaged in a ruthless campaign of assassination against Sunni tribal leaders and the remnants of the Awakening movement in Iraq’s Anbar province. Between 2009 and 2013, the Islamic State killed 1,345 Awakening members, according to doctoral research by the former U.S. Army officer Craig Whiteside. In Jurf al-Sakhar, a town south of Baghdad, 46 Awakening members were killed in 27 incidents over this four-year period. The slaughter was hardly a secret: ISIS documented the drive-by shootings and point-blank assassinations in a video called “The Clanging of the Swords.” Was anyone watching in Washington? Evidently not. Officials in Baghdad, meanwhile, didn’t seem to care; Maliki’s government was probably as happy to see the killing of potentially powerful Sunnis as was ISIS.

The assassination campaign weakened Sunni resistance, helping ISIS seize Mosul in 2014. It helped too that ISIS had used Iraqi prisons as its training camps, building trust, operations security, and a passionate hatred for the Shiite-led government in Baghdad. This was a guerrilla army in waiting, and ISIS staged a campaign called “Breaking the Walls” to free these captives and bring them into the fight. Whiteside estimates that between July 2012 and July 2013, ISIS orchestrated seven major prisons raids, culminating in a spectacular, well-organized breakout at Abu Ghraib. (One of the first things ISIS did after sweeping through Mosul was to liberate the prison there, adding several thousand fighters to its burgeoning ranks.) One graduate of these prisons turned schools for jihad, Abu Bakr al-Baghdadi, is the current leader of ISIS.

Prior to the storming of Mosul, did anyone at senior levels of the Obama administration notice that, as the poet W.H. Auden wrote of the carnage of the Spanish Civil War, “our fever’s menacing shapes are precise and alive”? Apparently not. As U.S. Director of National Intelligence James Clapper admitted in an interview with me in September 2014: “We underestimated ISIL [the Islamic State] and overestimated the fighting capability of the Iraqi Army. … I didn’t see the collapse of the Iraqi security force in the north coming. … It boils down to predicting the will to fight, which is an imponderable.”

But ISIS’s potency was certainly clear to Sunni tribal leaders. In April 2014, two months before the capture of Mosul, I interviewed Iraqi sheikhs from Anbar. One of them, Jalal al-Gaood, told me by phone that in his hometown of Albu Ali Jassim, west of Ramadi, violent extremists had attacked a police building, prompting the Iraqi military to bomb and shell the village, and his entire tribe to move out of the area. Gaood offered a grim prediction: “Everyone tells me they’ve never seen what’s happening on the ground now. Hell has come to these villages and towns. It’s far worse than before.” Sheikh Zaydan al-Jabari, a tribal leader from Ramadi, told me that day: “Iraq is not now a state. It is led by gangs.”

Barack Obama couldn’t ignore the capture of Mosul. But even after the U.S. president successfully pushed to replace Maliki with a less sectarian prime minister, America struggled to gain the trust of Sunni leaders and recruit the kind of force that could roll back ISIS’s gains. In October 2014, on the morning after ISIS had gutted the pro-American fighters of his Albu Nimr tribe, Gaood told me that his pleas that night for help from U.S. Central Command had gone unanswered: “Every time the Iraqis meet with Americans, [the Americans] just take notes,” he complained.

That same month, Jabari said that the Sunni tribes again wanted U.S. help and “a strategic relationship with the Americans.” Yet he scoffed at U.S. plans to create a national guard for the Sunnis, saying it was “wishful thinking” because Iraq’s Shiites and Kurds would never agree to the proposal. Until Sunni rights are respected, he said bitterly, “we will not allow the world to sleep.” His warnings have so far proven correct: The U.S.-backed legislation that would authorize a Sunni national guard remains stalled in the Shiite-dominated Iraqi parliament.

I saw Jabari again in June 2015, a few weeks after ISIS had overrun the city of Ramadi (after bland reassurances from U.S. CENTCOM officials that the city would hold). Jabari was seeking support for his tribal fighters. (Like several Anbar sheikhs, he had by now hired his own D.C. lobbying firm.)

“Iraqis don’t want to live under the Islamic State, but where are they supposed to go?” he asked me. Shiite militias had blocked the way to Baghdad for Sunnis fleeing Ramadi; ISIS, meanwhile, was offering amnesty to families who came back to the city and turned over their sons to the Islamic State to fight. These tribal leaders simply do not believe U.S. assurances that America is in this fight for real. The sheikhs are selfish and self-interested, but can you blame them? They’ve been burned too often. The problem with the U.S. anti-ISIS strategy in Iraq is that it depends on a Sunni tribal movement that no longer exists.

* * *

What lessons can be drawn from the rise of ISIS in Iraq and the campaign so far against it?

First, anti-ISIS ground and air operations have been successful when they have been launched from areas with strong operational and planning resources and well-trained and motivated fighters. Iraq’s Kurdistan region is the obvious example, as I saw on a recent visit: Kurdistan Democratic Party peshmergafighters under the Barzani clan have pushed ISIS west and south, and squeezed ISIS-held Mosul. A visitor can drive unmolested today into the northern province of Nineveh and over the Mosul Dam, which in the fall of 2014 was in ISIS hands. Patriotic Union of Kurdistan militias have held their own in the northern Kirkuk area, though there’s growing concern among the Kurds and Americans that they are taking orders from Iran and its Quds Force. Similarly, Shiite militias, under Iranian supervision, have fought well in defending Baghdad.

The problem remains creating a Sunni force that can help the Iraqi military push ISIS from Mosul, Fallujah, and Ramadi, and then hold the retaken ground. Such a force would have to operate from a secure base—not just a logistical base, but a base of trust, in which the Sunnis feel they are fighting for a part of Iraq that will truly be theirs post-ISIS. Iraq’s ambassador to Washington, Lukman Faily, has told me he favors constitutional changes that would create the kind of Iraqi federalism that would truly give Sunnis some “skin in the game” and make a decentralized Iraq work.

Absent this essential political component, it’s hard to imagine how the current U.S. strategy against ISIS can work. U.S. military power could drive the heirs of Zarqawi underground, but without Sunni empowerment, the insurgents will be back as ISIS 2.0 or 3.0. It’s now clear that the “80-percent solution” is shorthand for the violent dismemberment of Iraq. If some new political balance that allows Sunnis to govern their land can’t be created in the country, we must reckon with the stark warning of the CIA’s former deputy director, John McLaughlin, to The New York Times: “If you add everything up … [ISIS] could win. Evil isn’t always defeated.”

The Syrian Roots of ISIS

Disentangling the story of ISIS’s expansion in Iraq at least produces a coherent narrative. That’s less true in Syria. The spread of the Islamic State there seems, in the famous French dictum, “worse than a crime, a blunder.” We’ll never know whether a more aggressive U.S. policy—arming the moderate Syrian opposition sooner or bombing the Syrian government’s command-and-control infrastructure after President Bashar al-Assad used chemical weapons against his people—could have produced a better outcome. But it’s hard to imagine a policy that would have done worse.

Where ISIS experienced organic growth in Iraq (in the sense that a metastasizing cancer can be called organic), in Syria it seems more a case of implantation. For all the mistakes in U.S. policy, the regional powers—Turkey, Iran, Saudi Arabia, Qatar—have taken truly reckless actions, making Syria a cockpit for their proxy wars. It was Turkey that allowed a southern border with Syria so porous that it offered ISIS and the al-Qaeda-affiliated Jabhat al-Nusra what amounted to a logistical safe zone. It was Iran that marched Hezbollah, a Lebanese militia whose mission was fighting Israel, into Syria to save Assad. It was Saudi Arabia and Qatar, jockeying for regional influence, that funded a scattershot array of Sunni militias that proved easy recruiting grounds for the extremists (and in this sense supported the extremists). And it was Russia that stood by while its client, Assad, bombed civilians and ravaged his nation, and then began doing the bombing itself.

Russia’s recent military intervention in Syria—nominally to fight the extremists, but more to prop up a government that protects Russian interests—is power politics in its rawest form. Vladimir Putin understood this summer (as the CIA did) that Assad’s regime was losing ground to Islamic rebel groups. Russian military operations (coordinated with Iran) were focused not on ISIS strongholds in the northeast, but on U.S.- and Saudi-backed forces in the northwest, close to Assad’s Alawite homeland in Latakia. Putin may be angling to strengthen Assad’s hand in anticipation of the political negotiation that both Moscow and Washington say is needed. But so far, the Russian-Iranian partnership with Assad has only deepened the sectarian nature of the war.

Meanwhile, U.S. strategy in Syria has been so feeble (and its implementation so inept, as in the worst days of the Green Zone) that the United States at this writing seems like a junior partner, with Russia taking the decisive role in shaping the battle against ISIS.

Syria seems increasingly like one of those Agatha Christie books where every character has had a hand in the crime.

I first visited Syria in the early 1980s, witnessing the systematic destruction that Assad’s father, Hafez, had visited upon Muslim Brotherhood strongholds in Hama. Later, I was one of many Westerners who had regular conversations with Assad and his advisors between 2000 and 2010 about what the Syrian president claimed was his recognition of the need for political reform in Syria. As a result, I traveled to Damascus from Cairo in February 2011 with great curiosity. In Egypt, Hosni Mubarak’s government had just fallen in the Tahrir Square revolution that marked the apex of the Arab Spring. What would Damascus, scene of so many coups and counter-coups during its modern history, bring to this revolutionary moment?

Assad’s advisors were buzzing about the president’s plans for reform. He knew his Baath Party was corrupt, one insisted. He knew the power of his relatives, the Makhlouf family, had to be curbed, said another. Reformers confided how on February 19, police had assaulted a driver in downtown Damascus. It was a normal day in authoritarian Damascus—but not in the age of the cell phone and the hashtag. Hundreds quickly gathered in the capital’s streets and began chanting: “We are the people. The people won’t be humiliated.” Video footage of the drama was posted to the Internet, and made its way into Syrian homes. Syrian officials initially responded wisely. The minister of the interior arrived about 30 minutes after the protest started, apologized to the man who had been beaten, and escorted him away in his car. The police officers were disciplined. The crowd gradually ebbed, and some (doubtless with official encouragement) began chanting Assad’s name.

The regime wasn’t so lucky a few weeks later when protests spread to Daraa, the provincial capital south of Damascus. The Houranis (as the people of this region are known) are famously feisty, and they pushed the local police and military hard. The authorities, led by a bullheaded provincial governor, started firing back. Civilians were slaughtered. And the Syrian revolution had begun.

Several factors made this revolution especially disorganized (and prey to manipulation by extremists). First, it was a genuinely bottom-up movement, with each mosque gathering its own young men into brigades to defend the local area and then (in theory) fight a larger war to overthrow the regime. The Muslim Brotherhood, devastated by Hafez al-Assad in 1982, lacked the discipline and organization that could have helped weld a strong opposition. The moderates were hapless.

Second, as in Iraq, the revolution arrived in a country that had suppressed deep sectarian divisions. Sunnis appreciated the stability and “Arabism” that the Assad regimes had brought, but they felt humiliated by their subservience to leaders who many derided as Alawite bumpkins from the mountains. In light of these tensions, Syrian minorities banded together behind the regime.

Because of the disorganization of the opposition, and the sectarian character of Syrian society, the civil war got nastier after 2011. Inevitably, the opposition became more Sunni and proto-jihadist. In October 2012, I traveled inside the country for two days with the help of the Free Syrian Army (FSA), and came to three basic judgments:

First, there aren’t enough weapons for the rebels to defeat Assad’s forces, and almost every Syrian I talked to thinks this is America’s fault; second, the commanders of the Free Syrian Army are trying to exercise better command and control over what has been a disorganized, ragtag operation; and third, in this chaotic and under-resourced fight, the power of the Salafist jihadists—who ask only to be martyrs—appears to be growing.

It seemed clear that absent U.S. training and assistance of the moderate opposition, these problems would only get worse.

A CIA covert training program began, sort of, in 2013. Working with the Jordanian General Intelligence Directorate (GID), the CIA had some success in building a “southern front,” but U.S. and Jordanian policy restrained the opposition from any move that might topple Assad prematurely, before his successor was clear. The CIA’s program had even less success in the north. I’ve interviewed most of the pro-American moderate commanders who operated from Turkey: a former military-science professor named Selim Idriss; a loud former Syrian Army colonel named Abdul-Jabar Akaidi; a roustabout guerrilla leader in Idlib named Jamaal Maarouf; and Hamza al-Shamali, the leader of what was the largest CIA-trained force in the north, known as Harakat al-Hazm.

None of these Syrian commanders had the military leadership skills or command presence to create an effective opposition. Shamali’s group got chased from its bases in Idlib by the jihadists from Nusra. “At some point, the Syrian street lost trust in the Free Syrian Army,” Shamali explained to me in a 2014 interview at a safe house along the Turkish border. He bluntly admitted that many FSA commanders weren’t disciplined, FSA fighters were poorly trained, and the loose FSA structure hadn’t provided adequate command-and-control capability. Sadly, he said, “the question every Syrian has for the opposition is: ‘Are you going to bring chaos or order?’”

The United States tried to bolster these nominally covert Syrian missions with an overt “train and equip” program backed by $500 million in congressional support. The program proved a dismal failure, and was terminated by Obama in October. A first “class” of 54 trainees was inserted into northern Syria in July 2015 and promptly attacked by Nusra fighters. The debacle resulted from poor intelligence about Nusra’s intentions, poor planning about how the U.S.-backed force would operate on the ground, and an unworkable system for vetting recruits that disallowed those who wanted to fight Assad rather than ISIS. The U.S.-backed rebels, in effect, walked into a trap—in a mission that recalled, to some Pentagon officials, the failed Bay of Pigs landing in Cuba in 1961. To me, the botched effort encapsulated all the contradictions and uncertainties of U.S. policy.

Some in the White House seemed almost to gloat over the collapse of the train-and-equip program, as if this showed that their reluctance to back Syrian rebels had been right all along. How nice it would be if American inaction—and America’s waffling, wobbling approach to Syria—could be described as success. Alas, not so.

The extremists of ISIS and al-Qaeda filled the vacuum left by the moderate opposition. Early in the war, the momentum seemed to be with Jabhat al-Nusra, the al-Qaeda affiliate. When I asked an FSA commander in Aleppo in 2012 whether his men fought with Nusra, he answered: “Of course, they’re the best fighters.” If the FSA needed hardened men for an assault, they would turn to the suicide bombers of Nusra, who were often foreign fighters looking for a ticket to paradise. I asked a Syrian doctor what he had learned from treating rebel casualties at the front. A large majority of those with serious wounds were from Nusra, he said. Inevitably, people, arms, and money began flowing to the fighters who were the toughest and best.

ISIS played a spoiler’s game in Syria. It moved to Raqqa, an area adjacent to its supply lines into Iraq, and used the city as a kind of logistics base camp for its bigger Iraq operations. Raqqa soon became the “capital” of the “state,” and the destination for thousands of foreign fighters. It prospered in part because it wasn’t bombed by Assad’s air force, which was leveling every other civilian area under rebel control.

You don’t have to be a conspiracy theorist to understand why Assad allowed ISIS to put down roots: He needed a threat to show the West why his regime’s survival mattered; he needed to demonstrate that there was a worse Syrian face than his own—that of Abu Bakr al-Baghdadi, ISIS’s leader. (If you are a conspiracy theorist, you would also note the strong intelligence connections that developed between the Syrian Mukhabarat and al-Qaeda in Iraq during the Zarqawi days.)

* * *

Since visiting Syria in 2012, I have believed that the shattered nation can gradually be stabilized if the United States and its allies seriously commit to building a new Syrian force that can help fill the vacuum, post-Assad. But the halfway measures taken by the U.S. thus far have only helped the jihadists.

Friction between ISIS and Nusra is nearly as strong as the old infighting between Zarqawi and bin Laden. The United States and its allies are doubtless working to exacerbate these cleavages, which suggest that the jihadists’ power can be degraded over time in Syria. Raqqa is now flanked to the north by Syrian Kurdish forces who are receiving ammunition and air support from the United States; as the squeeze intensifies on ISIS forces there, Nusra will have to decide whether it wants to come to the apostates’ aid or let them be pounded. Either way, Nusra will suffer in the eyes of its followers.

Should the United States and its allies target Nusra and ISIS equally? Prudence argues for a strategy that treats ISIS as the first priority. The toppling of ISIS would curb the momentum of extremist forces more generally. Some Qatari officials have told me they think Nusra can be split into several factions, and that many of its fighters can be co-opted by Qatar, Saudi Arabia, or Turkey into less menacing groups that reject foreign terror operations. This may be wishful thinking, but it’s worth exploring. The message to Nusra should be that attempts to spread terror outside Syria will provoke devastating U.S. and allied attacks.

What’s the pathway out of the Syrian disaster? Based on my reporting, I’d offer several conclusions, which haven’t changed much in the last three years:

The best hope for Syria’s survival is a political solution—jointly brokered by the U.S., Russia, Iran, Turkey, and Saudi Arabia—that begins the transition to a new, post-Assad government.

But such a political solution will be impossible without a strong, U.S.-backed opposition that can merge with “acceptable” elements of the Syrian army to manage a transition from Assad.

This transition process will be fostered by safe zones in the north and south, where humanitarian assistance can be directed, Syrian refugees can return, and political compromise can be rediscovered.

If these steps cannot be taken, the result will be the continuing growth of ISIS and other extremist groups, and the full collapse of a fractured Syria into a failed state and terrorist haven. Russian-Iranian military intervention can widen the boundaries of Assad’s rump state, but it cannot rebuild a united Syria.

ISIS’s power will only be enhanced in Syria by Assad’s continued hold on power. That’s why a campaign against ISIS that doesn’t include the goal of bringing new leadership to Syria is short-sighted. And yet fears that a freewheeling regime collapse would give way to warlordism and terror across Syria are justified. For now, Syria offers a grim lesson: Muddled U.S. policies can produce as disastrous an outcome as military intervention.

My friend Raja Sidawi was right 12 years ago: America has not changed Iraq or Syria, but the wars there have indeed changed America. Americans have learned the limits of military power and covert action; the U.S. has helped create enemies that did not exist before George W. Bush’s mistaken invasion of Iraq in 2003 (I described my own mistakes in supporting the Iraq War, and explained the lessons I drew from this horrible experience, in a 2013 column); it has fostered a degree of mistrust so acute that many in the region now welcome the vain autocrat Vladimir Putin as a deliverer. Obama’s policies may have been weak and feckless, but they have reflected a widespread desire among Americans to extricate the country from the Middle East’s long wars.

As Russian planes conduct dozens of sorties a day over Syria, the cover of the November/December 2015 issue of Foreign Affairs proclaims: “The Post-American Middle East.” That’s a bit hasty. Nothing in this part of the world is ever really over. But the people of the Middle East finally own their own history. The only people who can fix this mess are the citizens of the region themselves, and it’s going to take a very long time.

This article is adapted from a paper for a forthcoming series from the Aspen Strategy Group.