This article, originally published on October 16, 2016, was updated on March 21, 2017. It appears in abridged form in the April 2017 issue of National Geographic magazine.

The Kurdish soldiers stood on a berm, next to a gunner’s dugout, in a corner of their position. It was one of several forward positions on a front line that ran along the crest of a mountainside and faced west onto the Tigris River Valley. The sun had set on a late summer day—the driest season in Iraq, when land and sky seem to merge. Still, through the thickening dark the soldiers could make out, on the river’s near bank, the lights of the city of Mosul. Though this was a vista they could have described in their sleep—for months these soldiers, who were with the peshmerga, the army of Iraqi Kurdistan, had surveilled and mapped and discussed every inch—its fascination and menace never dimmed. Everything they looked at belonged to the Islamic State.

It was late July 2016, and the battle for Mosul, long rumored, was finally at hand. A liberation force was assembling. The Iraqi military had beaten the Islamic State, also known as ISIS, out of Fallujah and was now fighting its way north toward Mosul. The peshmerga was pushing in from this mountain. U.S. and European forces were massing, as were soldiers and militiamen from Turkey, Iran, and elsewhere. It was the biggest show of international force against ISIS yet. ISIS had held Mosul, Iraq’s second largest city, for two years.

Mosul’s fall would drive the jihadists from the country once and for all, the planners hoped.

Inside Mosul there was panic. The United Nations had estimated that more than a million people would be displaced by the battle. (Before ISIS, Mosul had about 1.4 million residents.) Civilian casualties would be terrible: ISIS was busy mining streets and booby-trapping buildings. Residents were escaping the city by any means they could, and this Kurdish position was the terminus of a popular escape route. Almost every night people scrambled up the mountainside, arriving here with only the clothing on their backs.

Tonight the soldiers were expecting a family of seven. The father, a nurse, had phoned a cousin who lived near the mountain. The cousin had notified the commander. Now cousin and commander stood on the berm together.

The family’s journey would be treacherous. If they were caught by ISIS trying to escape Mosul, they might be jailed, beaten, beheaded, or all three. If they got out of the city, that was only the beginning: Next they would have to get to Fazilia, the village the position overlooked, at the foot of the mountain. ISIS controlled Fazilia and sent up the slope homemade artillery—including, lately, crude chemical missiles—snipers, and suicide bombers. (Recently a pair had gotten to within 50 feet of where the soldiers now stood before blowing themselves up.) If the nurse’s family made it out of Fazilia, they would have to negotiate the mountainside’s boulders without aid of trail or light. With so much dust in the sky, not even the moon would help.

View Images Ayham Ali's wife, Nawal, and children arrive exhausted but grateful to be safe at the peshmerga position above the village of Fazilia.

View Images A Kurdish soldier consoles a child, also from Mosul.

Two days before, the nurse had sent his wife and children from Mosul with a people-smuggler. That afternoon he had reconvened with them near Fazilia. They crouched among the olive trees until sundown. The cousin, whose name was Tayeb, had been able to give the nurse only the vaguest of directions: “Go up the mountain.”

Tayeb’s phone rang. It was the nurse, whose name was Ayham Ali. Tayeb handed the phone to a Kurdish interpreter who translated the directions from the soldiers to Ali. (Ali spoke Arabic, the soldiers Kurdish.) In the pressure of the moment and his eagerness to encourage Ali, the interpreter gave the nurse a promotion.

“Where are you, doctor?”

An anxious voice came from the other end.

“Go 500 meters to the right. You’ll see a small valley. Go into the valley.”

The crying of a child came through.

“Don’t worry, doctor. You’re safe now.”

A soldier switched on a flashlight and moved it from side to side.

“Tell him to follow the light,” the soldier said.

“Doctor, do you see the light?” the interpreter said.

“Don’t move the light so much. ISIS might see,” said the commander.

For the next few hours, Ali hiked and then called for more directions, hiked then called. The connection broke off. For some time, nothing. When Ali called back, near 11 p.m., he was lost and worried. He had sent his eldest daughter ahead to try to find the way and hadn’t seen her since. He thought ISIS had spotted them. The interpreter told Ali to describe what he saw around him.

“I know where you are. Don’t go to the left. Go right. If you go left, you won’t make it. It’s too steep.”

Announcing he was going down to look for them, Tayeb jumped from the berm, followed by two soldiers. They kept pace with him until the drop-off, then stooped each to a knee and lifted their rifles to their shoulders.

View Images Smoke rises from the Qayyarah oil fields, set alight by ISIS.

Distended minutes passed. Near midnight Tayeb returned carrying a small girl, her eyes wide and wet with fear. He put her down, turned around, and disappeared again. A soldier picked her up; he bounced her gently and cooed. Soon a boy and two more girls, one the eldest daughter, arrived, and Tayeb came back with the youngest child in his arms. He had dropped her, and her forehead was swelling, but she was silent.

The mother, Nawal, which means “gift,” appeared. She wore a black abaya and black hijab. She sank to her knees. In a reverie or delirium she chronicled their ordeal to no one in particular.

“We were so hungry in Mosul. There was no money, no food,” she said. “It’s all right if we die here hungry. We’re safe. This is the best moment of my life.”

Ali, the last of the party, emerged behind her, looking ill with relief. His clothing was ragged, his scraggly beard glistening with sweat.

“Let’s move. There are snipers,” the commander said.

The soldiers brought the family toward the camp.

“We’re here. It’s fine if I die now,” the mother said.

They gulped down water.

“Don’t drink so much water. It’s not good,” the commander said.

“Our water finished on the mountain,” Ali said. “I feel like I’m in paradise.” He prayed for the safety of all Muslims and then took up his own narration. “It’s not easy to leave your parents. But I was dying there. There were 20 of us. My brother sold ice cream. He made no money. We fought, he and I.”

ISIS had seized Mosul two years earlier, in June 2014. A mix of Iraqis and foreigners, they rode into the city in convoys. They burned down the police stations and army checkpoints. They hoisted flags with the black-and-white ISIS logo, installed new imams in the mosques, new teachers in the schools. From the Great Mosque of al Nuri, Abu Bakr al Baghdadi, newly split from al Qaeda, proclaimed the creation of the Islamic State and himself its caliph. He commanded Muslims everywhere: “Obey me.”

Some residents fled; others went into hiding. Many rejoiced. How Ali had felt, he didn’t say, but at first, he recalled, life wasn’t bad. He was able to continue working at the hospital. Soon enough, however, the misery began. There were, of course, the torture and executions in public. These became so common as to be unremarkable, though never did they cease to be horrifying. But with enough caution one could avoid them. Unavoidable was the tedious ignominy of daily life. Everything was regulated, everyone watched. The jihadists’ greatest concern was appearance, it seemed to him. The worse life got, the more ISIS flags went up. Ali was made to cut the length of his pants to adhere to the “Afghan” style ISIS leaders preferred. He was told to grow a beard, then grow it longer. To go in public, Nawal had to be accompanied by a man in her family and cover herself entirely in black.

“If she wore even a sandal with a heel, she might be beaten,” Ali said. “They didn’t treat us like humans.”

In 2015 Mosul was cut off by security forces. The markets went empty. The electricity was cut, then the water. ISIS got more brutal. When Ali bandaged the hand of a woman who wasn’t fully covered, he was accused of being sexually involved with her. He was jailed and received 50 lashings and counted himself lucky to still have his head. Air strikes flattened Mosul around him. He realized he must risk a quick death and leave—or stay and die slowly.

View Images In Al Alam, near Tikrit, 11 local men were publicly executed near the intersection where a memorial to them now stands. Monuments, billboards, posters, and artwork commemorating the victims of ISIS's atrocities are increasingly common around Iraq.

Near Makhmur, a government-controlled city south of Mosul, is a large refugee camp. Like all refugee camps in Iraq, it’s overflowing; the war with ISIS has internally displaced more than three million Iraqis, according to the UN, and sent another quarter million to seek safety abroad. In this particular camp the men were cordoned off, not for religious reasons but because there might be ISIS members among the refugees. The camp had subsumed a primary school, where women and children gathered. In the classrooms the desks had been pushed to the walls and the floors heaped with clothing, bedrolls, teapots, buckets. In one classroom two middle-aged sisters-in-law recounted how Mosul was overrun.

“People clapped and threw sweets at the ISIS trucks,” one sister said, and she understood why. For years the national government in Baghdad had neglected Mosul, as it had so much of Iraq. Services were inadequate. The economy was dormant. And for years—since the U.S.-led occupation began—men in the city, particularly Sunni Muslims, had been abused by security forces. They were routinely accused of being insurgents for no reason. Her brother and her cousins were jailed and beaten. Some men never returned. This was true of all the Sunni families she knew. “Many men were taken.”

The decent soldiers and police they knew, meanwhile, felt no allegiance to the government. In the weeks before ISIS invaded, some of these men found letters tacked to their doors reading, “Quit the army or die.” Others received anonymous phone calls from someone who said, “Leave the police force, or you’ll be beheaded.” They quit, of course. Some fled, some hid, some joined ISIS, whose leaders said they were there to free the people from the government, from irreligion and dishonor. The people believed them.

It wasn’t long before the Hisbah, ISIS’s religious police, turned a cemetery in the sisters’ neighborhood into an execution ground. Locals, including children, were made to watch the beheadings. Cameras were set up, and the footage was broadcast on jumbo screens mounted at intersections and in plazas.

View Images Streets in Fallujah, wrested from ISIS in June, are deserted.

Among the people who had welcomed ISIS was a neighboring family. One of the sons, a student, joined up. He was pleased with himself. One day, a sister took him aside and said, “ISIS is laughing at you, you know. They just want to kill you.”

He was enraged.

“When you speak to me like this, it’s the same as insulting the Prophet,” he said.

He was later killed in a battle.

“Even his mother was praying for ISIS,” she said, her brow raised almost to the hem of her hijab in disbelief, a look in her eyes that might have suggested amusement if it wasn’t so full of noble distaste. “These people are waiting for their deaths.”

At the Makhmur military base, a soldier from Mosul in his 30s named Salim was discussing the same subject with colleagues. Lighting a cigarette, he pointed out that ISIS’s takeover hadn’t been sudden. It was common knowledge that for years the dissident underworld in Mosul—a mixture of Islamists, nationalists, guns for hire, and young men with nothing better to do—had been talking about overthrowing Iraq’s then prime minister, Nouri al-Maliki, a Shiite. This underworld, out of which the stridently Sunni Islamic State would grow, was extreme, but it represented a discontent that many in Mosul—indeed, that many Iraqis—had felt since 2003.

The Reach of ISIS In 2014 ISIS insurgents stormed into Iraq from Syria, gaining ground toward Baghdad. Now Iraqi state forces, Kurdish soldiers, and various militias—with help from a U.S.-led coalition—are regaining control. ASIA SYRIA IRAQ AFRICA TURKEY Mosul Dam Badush Dam Raqqa (ISIS capital) Aleppo Mosul Baiji Oil Refinery Al Qaim Border Crossing IRAN SYRIA LEBANON IRAQ Damascus Al Walid Border Crossing Baghdad Turaybil Border Crossing Tigris JORDAN WEST BANK Euphrates ISRAEL SAUDI ARABIA KUWAIT Cumulative extent of ISIS’s reach, 2014–2016 100 mi 100 km Infrastructure targeted by ISIS Reclaiming Mosul An offensive to expel ISIS from Iraq’s second largest city, Mosul, began in October 2016. Targeting infrastructure In addition to occupying cities, ISIS took over key strategic sites like dams, border crossings, and oil refineries. Safe haven Baghdad and southern Iraq avoided the onslaught of ISIS fighters as they expanded into Iraq in the summer of 2014. The Reach of ISIS In 2014 ISIS insurgents stormed into Iraq from Syria, gaining ground toward Baghdad. Now Iraqi state forces, Kurdish soldiers, and various militias—with help from a U.S.-led coalition—are regaining control. ASIA SYRIA IRAQ AFRICA Reclaiming Mosul An offensive to expel ISIS from Iraq’s second largest city, Mosul, began in October 2016. TURKEY Mosul Dam Badush Dam Tal Afar IRAN Mosul Aleppo Raqqa (ISIS capital) Erbil Mount Sinjar Qayyarah Makhmur Safe haven Kirkuk SYRIA Baghdad and southern Iraq avoided the onslaught of ISIS fighters as they expanded into Iraq in the summer of 2014. Baiji Oil Refinery Al Qaim Border Crossing Tikrit Dhuluiya LEBANON IRAQ Al Walid Border Crossing ANBAR governorate Damascus Ramadi Baghdad Rutba Tigris Fallujah ISRAEL Turaybil Border Crossing Hillah Karbala Najaf Amarah JORDAN WEST BANK Euphrates Nasiriyah Targeting infrastructure GAZA STRIP In addition to occupying cities, ISIS took over key strategic sites like dams, border crossings, and oil refineries. Basra SAUDI ARABIA KUWAIT Persian Gulf Cumulative extent of ISIS’s reach, 2014–2016 100 mi 100 km Infrastructure targeted by ISIS DAMIEN SAUNDER, NG STAFF. SOURCE: IHS CONFLICT MONITOR; Institute for the Study of War

The militants carried out bombings and assassinations. They killed a brother of Salim’s. Even his own family was split between soldiers and insurgents.

“My brother was killed by our cousin,” he admitted.

The other soldiers groaned knowingly. Many families were so divided.

It took the army in Mosul six days to collapse. Ten thousand soldiers were run off by an ISIS force of perhaps 1,500 men. No one is certain exactly why. Fear, indifference, conspiracy. After his unit disbanded, Salim paid a smuggler to take him to Baghdad. He had heard, as everyone had, that some commanders had been in league with ISIS. It is commonly believed that the prime minister ordered the city forsaken. “Leave it to the jihadists,” he is rumored to have said. The state was meaningless. National unity was a fiction. Salim’s eyes welled, and he pounded a closed fist to his chest.

“This is what breaks my heart!”

“Mosul was sold by Maliki,” a soldier said.

View Images Soldiers inspect a shallow grave at a teachers college in Fallujah that ISIS had turned into a court and execution chamber. Corpses were buried in mass graves under paving stones and floorboards.

There is little ambiguity in how the Islamic State managed to take so much of Syria, where various insurgents have carved out niches. The same is true of Libya, the group’s toehold in North Africa. More complex, and more revealing, is the question of how it won over so much of Iraq, a country that in 2014 was more peaceful than it had been in years, a state on the mend. How did the group lay hold of Mosul, Iraq’s second largest city, in less than a week—and of Fallujah, Ramadi, Tikrit, vast swaths of countryside?

One explanation, so obvious it is usually ignored, is that ISIS is very much a product of Iraq. True, its proxies and sympathizers have staged attacks in at least 29 countries, killing almost 3,000 people. True, citizens of as many as a hundred countries have gone off to join its ranks. But for all of ISIS’s claims to be a “universal caliphate,” all the group’s expansionism and polyglot enticements, it was created in Iraq and is led by Iraqis. It burst from the cauldron of Iraqi history. And it was among common Iraqis—exhausted by two generations of war, disgusted with their leadership, surfeited with disgrace—that ISIS won its most crucial popular support.

Mosul provides some insight, but to really understand the rise of ISIS in Iraq, one must look to the so-called Sunni Triangle, and specifically to Anbar Governorate. Geographers consider Anbar, Iraq’s biggest province (for square mileage it surpasses Greece), part of the Arabian Peninsula. Its expanse of steppe and desert in Iraq’s western extremity shares more borderland with Saudi Arabia, Syria, and Jordan than with Iraq. Governed largely by tribal tradition and sheikhs, Anbar is the center of Sunni culture in Iraq, as well as the seat of opposition to the national government in Baghdad and, it might be said, to modern notions of government generally.

The Islamic State began gestating, as a collective of Sunni Islamist groups, by 2006. Over the next half decade it gained shape and power, taking in former Baathist fighters left over from the time of Iraqi president Saddam Hussein, deposed in April 2003. In 2012 and 2013, ISIS metastasized throughout Syria. In the first days of January 2014, it took up arms in Ramadi, Anbar’s capital. A few hundred militants seized much of the city. As they would in Mosul, the government forces collapsed, though they managed to hold on to a portion of Ramadi. For most of the next two years, its residents lived in an intermittent war of attrition. The situation drew comparisons to partitioned Berlin.

The Iraqi military reassembled and was joined by Shiite militias and a U.S.-led international coalition. At the end of 2015 Ramadi was “liberated,” as state television put it. But to anyone returning there this summer, when residents who had fled were being allowed back en masse, that seemed an optimistic word. Now the city actually looked like postwar Berlin. Firefights and bombings and air strikes—many of the last indiscriminate, the extent of the destruction suggested—had left Ramadi in rubble. Whole districts were not just uninhabitable but unrecognizable.

On a corner in the Tamim neighborhood, a onetime ISIS stronghold, stood a large house that belonged to a prominent family who had fled. A son had returned and was taking in anyone who needed a place to stay. Among the guests sleeping on his floor were men who had fought against ISIS and men who had sided with it. One of the latter was Abu Hamsim, in his late 30s, muscular, partial to a pink polo shirt whose collar he kept popped. He was proudly devout but not sanctimonious. He didn’t smoke and sequestered himself to pray five times a day and didn’t mind his housemates smoking and blaspheming around him.

Though Saddam Hussein was from Tikrit, Anbar was his real base of support. It was here that, after being chased from Kuwait in 1991, he came to proclaim his victory in “the mother of all battles.” It was also through Anbar, for centuries the gateway into Iraq for new ideas coming from other parts of the Muslim world, that the tracts of the Muslim Brotherhood arrived. The sermons of more extreme Salafist clerics followed.

View Images In Kirkuk a prisoner who admitted working as a bombmaker for al Qaeda and then ISIS is held at a local police base.

“Life was good under Saddam,” Abu Hamsim said. Even after the first Gulf War, when Iraq was embrittled by international sanctions, there was enough to eat, free health care and schooling, cheap gas, little crime. “People respected—feared—the law.”

Abu Hamsim was a soldier serving on a Scud crew when the next war with America began. His commander, knowing his men stood no chance, told them not to fight. Abu Hamsim considered this cowardice and treachery. “We should have defended our country.” The occupation shattered Iraqi society and unmanned people like Abu Hamsim. The two main points of pride and identification for the Sunni men who ran things under Saddam—the Baath Party and the military—were dissolved. Unwilling to rejoin the army and work for the Americans, he nonetheless relied on them, as so many Iraqis did. A contractor, he needed the income from U.S.-funded reconstruction projects. This only added to his humiliation.

Abu Hamsim knew men in al Qaeda and other extremist groups, and he didn’t begrudge them their views. He felt the same anger. But he never joined them, he said, because “I knew the people who would suffer the most would be Iraqis, not Americans.” Soldiers he knew who did go back to work were killed by insurgents. He was arrested by U.S. troops on suspicion of building a school with terrorist funding. Released, he was threatened by insurgents who accused him of collaborating with the enemy.

In Anbar and elsewhere, Iraqis retreated into tribe and Islam. In the army’s place sprang up a culture of militias: Sunni militias, Shiite militias, militias belonging to politicians, militias owned by sheikhs. It was in Anbar that Sunni insurgents—a mix of local Islamists, nationalists, and foreigners—consolidated. They fought coalition forces and pursued a sectarian war against Shiites that left tens of thousands of Iraqis, mostly civilians, dead. In 2006 a number of Islamist groups, led by al Qaeda in Iraq, created the Islamic State of Iraq. Abu Bakr al Baghdadi took direction of both groups.

In 2012, after the last U.S. troops withdrew, residents in Ramadi and other cities began protesting Nouri al-Maliki, whom Washington had installed six years earlier and backed with increasing regret. The protesters were fed up with his neglect, his acceptance of corruption, and the abuses of the Shiite-led security forces, worse in Anbar than in Mosul. Since entering office, Maliki had brought the Shiites to dominance after decades of repression under Saddam. It was taken for fact that Maliki, with his ties to Iran, was doing that country’s bidding.

To Abu Hamsim, the new Shiite elite was worse than the Americans. At checkpoints, when he tried to drive from Ramadi, he was stopped and insulted. Since he was from Anbar, he must be a terrorist, he was told. “They made obscene comments about my sister and my mother.”

Spreading across Anbar, the protests went on for a year. Every Friday thousands took to the streets. Maliki had Sunni officials arrested, claiming they were part of a conspiracy against him. Demonstrators were jailed, and killed. The movement turned into a “tribal revolution,” backed by sheikhs. At the same time it was infiltrated by ISIS, which by then had split from al Qaeda, allied with Iraqi nationalist groups, and taken nearly a third of Syria.

View Images A refugee family lives amid the rubble of Ramadi, which has sustained more damage than any other Iraqi city.

When the protests began, Abu Hamsim supported them. And when they turned into the tribal revolution, he supported that. And when ISIS swept into his neighborhood, near the stadium in central Ramadi, and pushed out the abusive troops and the grasping officials, he supported that too.

“In the beginning we believed them,” he said. They gave people food and helped them rebuild their homes. They apologized to Abu Hamsim and his neighbors for the destruction they’d caused. “We’re here to support you Sunnis,” they assured him. They spoke of the insults Sunni women were forced to endure at the hands of Shiite men, of the ways in which Shiites defiled the name of the Prophet. “They were speaking mostly truths.” They recited Quranic verse beautifully and told stories about Muhammad that Abu Hamsim had never heard.

“They seemed like magicians,” he said. “I thought many times about joining ISIS.”

He attended two seminars given by the new imam at his mosque, who had been installed by the militants. The first, rudimentary, covered the basics of prayer and ablutions. In the second, after touching on more sophisticated topics of belief, the imam went into the obligation to wage violent jihad. It was his responsibility, Abu Hamsim was told, to kill not just infidels but apostates too, no matter if they were Iraqi, no matter if they’d done nothing to him. By “apostate” he knew the imam to mean Shiites. Abu Hamsim was repelled.

ISIS killed many in Ramadi, only some of them Shiites. He wasn’t pressured to join, but this proved little consolation. By the time ISIS was forced from the city, he and his family were living on scraps he scavenged from abandoned houses. The militants, he noticed, always seemed to have plenty to eat. One of his daughters had leukemia, and she hadn’t had a transfusion in months. ISIS had forbidden him from taking her to a hospital outside their territory. His other children were psychologically damaged from the war.

“I learned to hate ISIS,” he said.

His family was taken by the army to a refugee camp, but Abu Hamsim was detained. For three days he was beaten, he says. He was never questioned—just whipped by soldiers with sticks and cables. He doesn’t believe they had any evidence on him or even cared whether he was a militant. They seemed to assume that any Sunni man from Anbar deserved to be punished.

‘YOU MUST TRY TO ESCAPE’

At the makeshift checkpoints around a liberated Ramadi, soldiers, short of everything including traffic cones, demarcated the lanes with mortar shell casings, bouquets of pink plastic flowers wedged into their hollows. Barricades of car parts, paving, and rubbish still blocked many roads.

Security forces had been clearing bombs, but the work wasn’t nearly done. Safe buildings bore spray-painted check marks, unsafe ones X’s. Everywhere one looked, it seemed, was the sinister bulge of a trip wire in the dust, or the rusted corner of a metal pressure plate, or a jerrican with calcified chemicals around its mouth. In some homes ISIS sniper nests were intact, their bulwarks of cooking-gas canisters and upturned credenzas and on-end mattresses still crammed between door jambs. The rooms were so chewed by gunfire they looked like caves. It was impossible to imagine people returning to these places.

Yet they were. A taxi drove into a deserted, ruined road and parked. It was unclear why. There was no one hailing a taxi—there was no one anywhere. Then the driver, an old man in a faded gray dishdasha, got out and disappeared into the wreckage.

Within it was his home. The second level had been sheared off in an air strike, as though by a giant scythe, but the first was standing, tentatively. Where his front gate had been, he had hung a blue plastic tarp. He’d returned four days earlier, he said, expecting to find nothing. He would settle for half a house over no house at all. The problem was, it couldn’t be reached. So he’d rented a bulldozer and cleared a path through the hill of splintered furniture and cinder block, from the pinnacle of which protruded the front wheel of a motorcycle.

“We think there are bodies in there,” he said. “We can smell them.” He kneeled, put his nose to a small hole in the wall that was keeping the pile at bay, and inhaled. He bade his visitors do the same. “Smell that?”

Nearby, a man was carting charred rubble from his home in a wheelbarrow. He had been the first to return to this street, he said, and had searched the houses next to his for bombs. He’d found one and painted on the exterior wall: “This house has bombs.” He had defused a bomb in his own house—its metal canister was on the curb now. He kicked at it.

“Don’t kick that! It could explode,” another man said.

“I already took off the cables.”

“It doesn’t matter—don’t touch it!”

View Images Sunni families displaced by ISIS have been living in a refugee camp near Tikrit for two years.

View Images Families fleeing the war with ISIS take shelter in the village of Hajjaj, in a grain silo that was hastily converted into a refugee camp.

A woman came to her door. She recalled that soon after ISIS stormed into Ramadi, she received a knock on the door, now battered but still on its hinges. She opened it to find two young jihadists. Politely they explained that they would soon be attacking an army encampment nearby and recommended she leave. The attack would take no more than two days, they promised. She thanked them and began packing.

Two and a half years later she had come home. Like the walls of most of the houses in the neighborhood, hers now had holes big enough for people to climb through. They were part of an elaborate system of passageways and tunnels ISIS had dug throughout Ramadi, as in every city, so fighters could move without notice. The men who had stayed here had looted some furniture, but she felt comparatively lucky, she said, pointing across the street to a row of pancaked houses and, in front of them, a truck-size crater filled with crude oil, where a gas tanker had been detonated. To create a smoke screen to obstruct air strikes, ISIS had tried to set the neighborhood ablaze.

The home of a furniture dealer, Abdula Zuhair, had been in the government-controlled section of the city, but only barely: The line of division had been a few hundred yards down the street. When ISIS came in, its men tied a laundry rope between homes on either side of the street—Zuhair recounted this by tracing a line in the air with his glowing cigarette—and then draped blankets over it.

At first there was a fragile stalemate between the government and ISIS. Zuhair had clients on the insurgent side and was permitted to go back and forth. Some differences were overt. For instance, the court building over there bore a sign saying “Military Court of the Islamic State.” Homes and businesses were spray-painted with the words “Property of the Islamic State Endowment.” Shops had to close before each call to prayer, five times a day. The black-and-white ISIS logo was everywhere, of course, on hoisted flags, stenciled onto walls. Other differences were subtler. ISIS considered depictions of people sacrilegious, and particularly forbidden was any representation of women. Zuhair noticed that on shop awnings and billboards, the faces of models had been cut away or the man’s face remained while the woman’s was painted over.

In 2015 Zuhair’s teenage son went missing. Zuhair suspected ISIS was involved—the group was known to kidnap for ransom. So he crossed the blanket line and went to a patrol station. He explained that his son, who was 16, was developmentally disabled. He couldn’t look after himself, much less be of use to ISIS. The men were helpful, ordering that announcements about the boy be made at mosques.

Soon after, however, a militant came to Zuhair’s furniture shop. ISIS had his son, and Zuhair had three options: pay $50,000 for his release, allow his son to join ISIS, or see him beheaded. Zuhair didn’t have anything like that kind of money. He offered his truck and all the money he had.

View Images Soldiers burn an area of marsh where ISIS militants were believed to have hidden.

Before he heard back, the Iraqi forces began their final assault on the city. ISIS men came to Zuhair’s street and demanded that his family flee with them into the desert. It was common knowledge that ISIS was press-ganging human shields, and he refused. He was jailed and whipped. After he was released, he and his family fled west to a government-held city where refugees were gathering. There, the boy’s captors, apparently taking pity on him, secretly brought him to see his father. The boy was in the Afghan-style dress, and wisps of hair grew from his chin.

“You must try to escape,” Zuhair whispered as they hugged.

“I can’t,” his son said. “They’re watching me everywhere. Maybe they will kill you or my mother.”

Zuhair had not seen him since.

One afternoon last summer, after Ramadi had been liberated, Zuhair drove into Ramadi’s city center. The main market street had come back to life. Shoppers stepped over piles of rubble and around a backhoe bringing down the remains of a building. A beloved kebab restaurant, reopened, was full with lunchtime diners.

He reached his furniture shop. He climbed over the collapsed metal awning and through a window frame. The display area had been plundered. He climbed through a hole in the wall into the adjoining commercial space, which ISIS had used as a bombmaking factory. On the unfinished concrete floor were sacks of coarse gray powder, empty cigarette packets, and two neat piles of human excrement. Another hole led into Zuhair’s twilit rear showroom, its overstuffed living room sets and fussy armoires coated in dust.

“My father opened this store in the 1960s,” he said. “It was the best furniture store in Ramadi.”

Down the street he said hello to a pair of brothers, owners of a photography shop. Somehow, it was unscathed. Zuhair looked admiringly at the windowpanes. He studied twin black-and-white photographs on the wall that the brothers had taken. They showed a before-and-after effect in the same stretch of downtown Ramadi. The first, from 1998, was a lively scene of shoppers and cars.

“It was during the sanctions, but things weren’t bad,” one brother said.

In the adjoining photo, the buildings were destroyed, the street empty. This one had been taken in 2007, the worst period of the U.S. occupation and the sectarian war. Pointing to the left of the frame, he said, “Over there was the American base.” Answering the attacks on their convoys with overwhelming firepower, troops had leveled Ramadi. But this shop and Zuhair’s had survived. They had survived ISIS. They would survive whatever came next.

“God willing,” Zuhair said.

“God willing,” the brothers said.

‘IT’S NOT IN MY HANDS’

The damage in Ramadi was the most extensive of any Iraqi city, but it was not rare. ISIS and the war against it had left large portions of northern and western Iraq in ruins. The violence had stretched from south of Baghdad to the borders with Turkey, Syria, and Saudi Arabia, engulfing dozens of cities—in addition to Ramadi, Fallujah had been overrun, as had Tikrit and Tal Afar—and hundreds of towns and villages. ISIS had decimated the Mesopotamian archaeological treasures of Nineveh and ancient Christian villages. It had attempted to wipe out the Yazidi people, whom it considered pagans. The fires it set at oil wells burned for months, causing untold environmental damage. By early 2017 the United Nations, its partners, and other organizations had erected 86 displaced-persons and refugee camps around Iraq. More than 3.25 million Iraqis had fled their homes.

Not just in Anbar but around Iraq, it is common to meet people like Abu Hamsim, or the brothers in the photography shop, who think back on the Saddam era with a certain longing. They have few illusions about the man—they don’t speak about him with nostalgia. Rather, they make it clear that under Saddam they understood Iraq. Now they don’t. This is another way of saying they no longer understand themselves.

The past 14 years have been an identity crisis for Iraqis. Just as they were reluctant to think of the sectarian violence of the 2000s as a civil war, not wanting to believe their society was capable of such cruelty toward itself, so many are unwilling to think of the fight against ISIS as a civil war. They don’t want to believe this monstrosity could have come from within. But ISIS is, whatever else it may be, an expression of that identity crisis. In this, its violent rise and fall is not just a religious war but a civil one.

With its promise of a pure and proud state, ISIS appealed to many Iraqis—men and women, young and old, rich and poor. Only some were zealots, but all were fed up with one or another entrenched power. ISIS appealed to Sunnis sick of the neglect and abuses they had experienced under Nouri al-Maliki’s Shiite-led government. And it drew in Sunnis who looked to the selfish Gulf monarchies, the brutal, secularist military of Egypt, the Westernizing Turks, and saw a void of valid leadership.

In July 2016 in Baghdad, a group of sheikhs was gathered at the capital mansion of a prominent sheikh from Ramadi, Rafaa al Fahdawi, discussing this subject. ISIS could not have taken so much territory without the help of sheikhs. Some fought ISIS, but many—no one is sure how many—backed it. And while some of the latter agreed with its ideology, others were acting pragmatically. ISIS seemed to promise a new, Sunni-centric regime and appeared competent—indeed unstoppable. In public few sheikhs will admit to any of this, but in private they’re more candid.

“We all understand that the government created the environment for ISIS,” Fahdawi said. And of course it was true that many had abided ISIS in order to stay alive. But there was blame to be ascribed too. In his own tribe, he estimated, as many as 200 men joined ISIS enthusiastically. This wasn’t a large percentage—it was probably far fewer of his tribespeople than the militants had killed—but it was a problem. Families were torn apart. “In many places you would see a family where one brother is a police officer and another is with ISIS,” he said. “A father kills his own son, or a son his own father.”

The sheikh’s son, who had been studying in London and had returned to “defend our land” against ISIS, he said, described how the jihadists skillfully tried to recruit him and other sons of sheikhs. Leaders called them directly on their mobile phones, appealing to their sense of Sunni unity and their vanity. A close friend succumbed. “I think they just washed his brain.”

Everyone in the room believed that the group had to have the help of powers outside Iraq, but who those powers were depended on the speaker’s particular view of Iraqi society and what had gone wrong with it. The culprit could be Iran, or Saudi Arabia, or the United States, or Israel. Psychologically, ISIS is a place where all suspicions and resentments, local and global, converge.

View Images Various Iraqi militias have joined the war against ISIS. In Hajj Ali, a town south of Qayyarah, a Sunni militia formed by a local sheikh patrols the roads.

The sheikh’s son thought ISIS wasn’t a Sunni organization. How could it be? It had killed so many Sunnis.

“I know that ISIS is Iranian,” he said, voicing an improbable but common theory. “They came to destroy Sunni society.”

One thing they agreed on was that Abu Bakr al Baghdadi had succeeded in ways Osama bin Laden never had. It wasn’t just that ISIS actually controlled territory or that it instilled more fear than al Qaeda. Baghdadi was more politically cunning. He and his associates had taken advantage of discontent in Iraq masterfully.

“They’re black belts in terrorism,” a sheikh said.

ISIS also appealed to the marginalized and dispossessed. It’s not a coincidence that Anbar is home to Iraq’s poorest and least educated citizens and that ISIS’s propaganda emphasizes the socialist undercurrent in political Islam. This class dimension of the war is often apparent, as are the other social rifts ISIS has heightened. As ISIS was being chased from Iraq, the alliance doing the chasing—Arab and Kurd, Sunni and Shiite, army and militia—was a delicate one. If not for a common cause, its partners would be at each other’s throats.

During the summer of 2016, Iraqi forces pushed north along the Tigris River. By August they had reached a small riverside city, Qayyarah, the last strategic gain needed before moving on to Mosul. One day, in the midst of the battle for Qayyarah, an army convoy drove from the base in Makhmur to the front line. A beige pickup was followed by a Humvee and a cargo truck carrying 200 blue plastic garbage bags containing rice, tea, sugar, cooking oil, food for those displaced by the fighting.

In the front seat of the pickup was a prominent general from Baghdad, one of the many planners of the campaign toward Mosul—or at least one of the many generals who believed he ought to be planning the campaign. The pickup reached a burned-out village, and the road divided into parallel sand paths. The already nervous driver was at a loss. There could be IEDs anywhere.

“Follow the tire tracks—don’t go left or right,” the general, a squat, balding man, said, and kept talking at a group of adjutants jammed one upon another in the back seat. “In Baghdad we wouldn’t stand for these ideas,” he said, referring to ISIS’s popularity in rural Iraq. “But out here people are disconnected from the world. They can’t think for themselves.” Then he began singing a song from a YouTube video he’d been watching.

The driver drifted to the left.

“No, not that way. That road has bombs. Go straight. They’ll shoot rockets at us.”

“All of ISIS are sons of bitches, I swear,” the general went on.

“None of them are human,” an officer in the back agreed. He had his own theory as to the group’s motivations. “They’re all gay.”

“That’s true,” another said, agreeing with the slur. “I knew a man who joined ISIS. He was already gay.”

The driver drifted again.

“Where are you going?” the general said. “Do you see any tire tracks? Don’t think like a Kurd. What’s wrong with your brain?”

The convoy arrived at a bend in the Tigris, south of Qayyarah, where soldiers with the Golden Division, an elite forward-operating brigade, were camped. The bridges had been destroyed, so they had built a pontoon bridge across the river. ISIS had been sending barrel bombs downriver to try to destroy it, so the troops had also run a necklace of empty oil drums across the water a hundred yards upriver from the bridge. For good measure they stood on the riverbank firing their rifles at anything bobbing in the current. Shots rang out, followed by the occasional plonk. Other soldiers bathed, unconcerned that they were submerged in a shooting gallery, or lay in the shade of truck chassis and the front-plates of tanks.

The convoy crossed the bridge and drove into a village, Jahala, where the food was to be handed out. Hundreds of people had already gathered in the central square. The men crouched in a line down the main road, shading their faces from the sun with ration cards that had been handed out, while the women stood in a less orderly queue in the shade. Every moment the lines grew longer. Knowing that a food distribution meant a tragic entertainment, crowds of young men and children had gathered on the porticos and terraces around the square to watch. Soldiers stood with rifles ready. There was an explosion in a village across the river—a missile strike, or very large mortar—sending a plume of dirt into the sky. No one flinched.

View Images A day laborer walks along a desert road toward the town of Khalidiyah, where tens of thousands of refugees have gathered.

The cargo truck backed up to the square, and the driver opened the tailgate. A tribal elder approached.

“This village has become like a refugee camp,” he told the general. “The population has gone from 700 to 25,000. They come here with nothing. We need more help.”

The general was handed a stack of ration cards. He read off names and handed out bags.

The air grew hotter, the lines longer, the women fretful.

“Give me a place here,” said a woman, trying to wedge herself into the line.

“No, this is our spot.”

“It was bad under ISIS, but this is worse,” said another.

“It’s better to be safe.”

“ISIS are all dogs.”

“Where is the general? I want to talk to him.”

People left their lines to approach the general and appeal to him personally, accompanied by murmurs of indignation. A man came up to him, but before he could open his mouth, the general said, “Don't talk. Get back in line.”

A small girl approached.

“You are young. Just like my daughter. Get back in line.”

It became clear there wouldn’t be enough food for everyone, not nearly. The women became unruly, refusing to sit down. The general bellowed at them.

“I swear to God and on the Quran and on Mecca, if you don’t make your line like the men, you won’t get help!”

The village elder implored the women.

“Please sit down. The general’s angry now.”

The last bag was handed out. The driver closed the tailgate and turned the truck’s engine over. Murmurs swelled into shouts, the lines into throngs. The general was surrounded. A soldier pointed his rifle to the sky and fired. A few villagers ducked; most took no notice.

“Don’t shoot!” the general yelled. The soldier apologized.

As the general tried to open the door of the pickup, a group of old women begged him for food, their hands outstretched.

“There will be more food tomorrow, God willing,” he said. “For today we’re done, but tomorrow we’ll have a thousand bags of food! Here, I’ll sing it for you.” He went into song. “Today we're done, but tomorrow we’ll have a thousand.”

The driver pulled forward. The elder rushed to the truck.

“If you bring us more help, my wife and daughters will cook for your soldiers.”

“It’s not in my hands,” the general said, rolling up the window. “This food doesn’t come from my father’s factory.”

View Images Young Sunni men fleeing the war with ISIS arrive at a checkpoint on the outskirts of Makhmur.

View Images To reach safety, people fleeing ISIS dodge sniper fire, swim across the Tigris River, and walk barefoot for hours.

‘THIS IS OUR HOME’

The Islamic State broke off from al Qaeda because its leader, Abu Bakr al Baghdadi, was too bloody-minded even for al Qaeda’s tastes. One conviction he and his jihadist alma mater do share is that, as historian of jihad David Cook has put it, “the entire world is united in a concerted effort to destroy Islam.” But where Osama bin Laden built his organization on the belief that Islam’s greatest foe was the “far enemy,” the imperial West, until recently Baghdadi focused on the “near enemy,” the impious governments of the Muslim world.

Worse still, Baghdadi sermonizes, are Shiites, a colonizing cancer within Islam. In this he follows on decades of sectarian politics in Iraq. In the 1970s the Baath Party deported people believed to be of Iranian birth. When Saddam Hussein went to war with Iran in 1980, he called himself the defender of the true Islam, the man who would protect Sunni Arabs from the Shiite Persian hordes, a menace since the seventh century. (This despite the fact that many Iraqi Shiites fought loyally for him.) Baghdadi is a child of this animus, which returned with the sectarian war of the mid-2000s, as much as he is of the U.S. occupation, and it has left him with a view of Shiites that can only be described as genocidal.

What then accounts for the irony that in Iraq his followers have almost certainly killed—and have certainly immiserated—more Sunnis than Shiites? Maybe this: ISIS marked a progression from al Qaeda not only in the professionalization of jihad, but also in its theorization, to a narrowed vision in which the Muslim who most deserves the name is a killing Muslim—a Muslim killing not just infidels, not just apostates, not just Shiites, but killing any Muslim who isn’t also killing. This vision was delineated most chillingly by the late Palestinian theorist of jihad Abdullah Azzam. “Honor and respect cannot be established except on a foundation of cripples and corpses,” he wrote. “Every Muslim on Earth bears the responsibility of abandoning jihad and the sin of abandoning the gun.”

The only thing more apparent in Azzam’s words than hatred is self-hatred. This is a politics of profoundest shame. More than homicidal, it is suicidal. So, perhaps unsurprisingly, many of the corpses of ISIS fighters that turned up in the latter months of 2016 were the victims not of combat but their own comrades.

That summer, as ISIS retreated toward Syria, the evidence of its sadism was on display nowhere so plainly as in Fallujah. Few places in the world have a name as synonymous with violence. Barely an hour’s drive from Baghdad, Fallujah is the nerve center of Anbari rebellion. After the British created Iraq, carving it out of the carcass of the Ottoman Empire in a deal with France and installing on the throne a foreigner from Hejaz, in what would become Saudi Arabia, Iraqis in Fallujah revolted. Known as the City of Mosques (“If Fallujah has 100,000 residents,” an Iraqi general joked, “90,000 of them claim to be clerics”), by the mid-2000s it was so laden with jihadists it had to be wrested from their control not once but twice. The battles for Fallujah, the fiercest of the U.S. occupation, are studied at West Point and in militant training camps alike. It was in Fallujah that Abu Bakr al Baghdadi was arrested.

In January 2014, ISIS seized Fallujah. In late June 2016, after a month of fighting, Iraqi special-forces soldiers won it back. On the stretch of highway leading into the city, light poles bent over themselves, jackknifed, and the concrete slabs of what had once been the off-ramp levered over the charred remains of an exploded gas tanker. Entering the city required driving over an expertly made six-foot-deep trench, dug at a perpendicular angle to the roadway and stretching for miles around the city’s perimeter. Beyond it was a sand wall. ISIS had constructed five such rings of defense to prepare for the final battle.

On the main thoroughfare palm trees stood palm-less and downed power lines lay like shorn hair on cratered pavement. In the bazaar the metal shutters had been rocked from clothing stalls, sending dishdashas and white knit prayer caps into mounds in the arcade. The city was empty of people except the exhausted soldiers, who stood around in the yards of houses they had commandeered, salvaging old generators, or by their Humvees, bouquets of pink plastic flowers wedged into the bullet holes in the windscreens. In Fallujah’s main plaza they had replaced the ISIS flag with an Iraqi one, but the flagpole was still painted in black and white stripes.

A group of soldiers and police walked through the wreckage-strewn streets to the Fallujah Women’s Teachers Institute. This had been an ISIS court and execution chamber. The air was heavy with the scent of decaying flesh. In the entry corridor was a cluster of overturned cabinets. Files of the young women who had once studied here, their photographs stapled to the corners of blue folders, fanned across the floor.

As the men came to a small courtyard, they put their hands to their noses in unison. A policeman pushed aside a chalkboard in the dirt, revealing a fibula. The bone jutted from a hole beneath a paving stone. They stepped closer. The hole was full of corpses in such a state of decay—no longer bodies, not quite skeletons—it was impossible to tell how many were there. In an adjoining hallway was another mass grave beneath the floor. It had been covered over with a carpet and sofa. A police commander explained that these were believed to be ISIS members, executed on suspicion of cowardice or betrayal or some other infraction.

When ISIS had taken the city, its fighters had made for the impressive central hospital and turned it into a headquarters. A strange choice, it seemed to some citizens, but the hospital had certain practical advantages. Aside from the fact that those doctors who hadn’t escaped could be forced to treat wounded militants, it was the most modern building in Fallujah, with computers, an industrial kitchen, and the best generators around, and it was next to the central mosque.

Less obvious to residents, at least at first, was its symbolic advantage. The hospital extended ISIS’s psychological power beyond the battlefield and the prayer rug. “We control you in health and in sickness, in life and in death,” it was a way of saying. Of course the battlefield was never far from its new owners’ minds: Best of all, the hospital served as a good defensive position. The highest building in Fallujah, it looked out onto the city. When the Iraqi forces returned, as ISIS knew they inevitably would, troop movements could be monitored from the hospital’s roof, artillery directed, gunners set up in its windows.

A group of men inspected the hospital. They walked through a courtyard. Morgue trays were on the ground, near a small, newly covered grave. A soldier put his hand down to his waist to indicate the height of the body buried in it. During the fighting it was too dangerous for locals to take their dead children from the hospital to the cemetery, so they buried them on the hospital grounds, in any space they could find.

In the emergency ward, framing and ceiling tiles hung down like jungle understory. A policeman—he went by Abu Nebah—searched for keepsakes, placing them in a plastic shopping bag. Gurneys and wheelchairs stood idle, as if waiting for their occupants to return. In a stockroom in which ISIS fighters had bunked, amid blankets and shoes and a teapot, lay a chest rig for Kalashnikov magazines. A soldier shined the light of his mobile phone on it and saw written in faded blue felt-tip “The Uzbeki.”

“Another foreigner,” he said.

Taped to the walls were grainy photocopies of the ISIS logo and official memoranda on ISIS letterhead. Phrases hinted at desperate last days in power. “To all brothers and section chiefs, may God bless them,” read a memo. “All brothers should bring back their families immediately to the Fallujah sector within 20 days from the date of this notice. Whoever violates it will not be allowed any time off.”

For the past week Abu Nebah and several other policemen had been watching over the hospital. They slept on the floor of the gatehouse and in the ambulance lane had set up a .50-caliber machine gun on a tripod, which they now stood around with a certain proprietary delight.

As Abu Nebah looked through his booty—some Kalashnikov shell casings and a black nylon utility belt—he said he’d known the hospital well even before taking up this post. All four of his children had been born here. He’d fled in 2004 during the two battles of Fallujah. Later he became a policeman at the height of the insurgency.

“But none of that was as bad as ISIS,” he said.

When the jihadists came in, those police who had the money to flee, did. Those who couldn’t, hid. And those who couldn’t hide gave themselves up. They were forced by the Hisbah to stand up in mosques and public squares, in front of crowds, and declare their regret for having enforced the laws of the infidel government. Some of them were killed even after these rituals of public humiliation. Abu Nebah fled with a hundred other families, basically his entire neighborhood. He returned to find his city in ruins for the third time.

“Why do you keep coming back?” he was asked.

“This is our home,” he said. “Anyway, it’s not as bad as Ramadi.”

He picked up a brown fuzzy object from the ground. It looked at first like a wig. He held it aloft, revealing a strap meant to go around the back of the head. It was a costume beard, worn by an ISIS fighter who was not hirsute—or old—enough to grow a proper jihadist’s beard. Though they’d seen the thing many times, the policemen laughed.

View Images Families rest at the makeshift refugee camp in Hajjaj, which has come to be known as Silo Camp.

‘I’M NEVER GOING BACK’

ISIS’s bloodlust is of course not new. What is new is the eagerness to package and broadcast it. Not just in the group’s snuff films and slick propaganda but in its fetish for “Afghan” martial dress, its insistence on putting its grim logo on every free surface, its painting of flagpoles, there is a childishly morbid aestheticism to the Islamic State.

That aestheticism materializes in bizarre ways. After the soldiers and policemen uncovered the mass graves at the Teachers Institute, they went upstairs, to an arts-and-crafts classroom, where students’ pieces were still pinned to walls: a beach scene, a dancing woman with a dress of plastic spoons. Scraped into the plaster between them, as though in a petulant rebuke and yet demure imitation of the artwork, was a man’s name.

“Abu Assam al Ansari,” a police commander said. “He was the warden here.”

They found Ansari’s office. It seemed that when not executing people, he indulged aspirations as a decorator. On his desk was a Styrofoam cup on which he had drawn his name, the ISIS logo, and the phrase “No God but God,” as though he’d been designing some heraldic chalice. On a bureau was a wood carving of a map of Iraq, something a teenager might make in a shop class, with blackened grooves demarcating the territory ISIS had taken. And in pride of place, on the wall before his desk, hung a canvas of Arabic calligraphy, perhaps made to buoy his spirits as he waited for the battle for Fallujah. In an unsteady scrawl of green and red glitter paint was written “The Islamic State Remains and Expands.”

With his rifle muzzle, a policeman knocked the canvas to the floor.

ISIS in Iraq U.S.-led invasion topples Saddam Hussein’s government First Battle of Fallujah —U.S. operation to root out extremists Second Battle of Fallujah —U.S.-led coalition offensive against insurgents Abu Musab al Zarqawi, founder of group that becomes ISIS, killed in U.S. air strike Abu Bakr al Baghdadi named leader of Islamic State of Iraq U.S. officially withdraws troops from Iraq ISIS seizes Raqqa, Fallujah, and Ramadi Al Qaeda and ISIS sever ties ISIS seizes Mosul Baghdadi proclaims himself caliph of the Islamic State Iraqi forces retake Ramadi from ISIS Iraqi forces retake Fallujah Iraqi forces retake strategic city of Qayyarah ISIS in Iraq NGM ART

For all its condemnation of the West’s immodesty, there is also an unmistakable pornography to the Islamic State’s violence. One needn’t watch many of its promotional videos to see that titillation, not religion, is the point, nor browse the Facebook profiles of its more public young male adherents for long to notice the sad vanity, the sexual frustration, the bashful homoeroticism.

The irony of this, like the irony of ISIS’s treatment of fellow Sunnis, is not lost on its victims. A running joke in Iraq is that foreign fighters come to their country, romantically conservative though it is, because they’re too pitiful to meet women at home. ISIS’s name in Arabic lends itself to a word play: With a few changed characters it becomes “The Sex State.” The insult is spray-painted over ISIS’s own graffiti in newly freed cities.

At the police station in Fallujah, after returning from the Teachers Institute, the men looked through ISIS court documents they had collected. It seemed that many women in Fallujah had taken the opportunity of ISIS’s rule to part from their husbands. In one divorce case the wife testified, “I demand to file a claim against my husband, Adnan, because he is sterile. He married me less than three months ago and had no sex with me except in the first week and then he said he was sick and could not take the pills he was taking before. He left a month ago and did not give me any money.” In response Adnan submitted that “the family of my wife prevented her from approaching me. I had sex with her the first day of our marriage and did not feel any sickness. The same on the second day. But now I am sick and am taking pills I got from Abu Omar and Abu Suhaib. It is religious medicine. My wife wants to come back to me.” Based on a Quranic citation, the ISIS judge ruled in the wife’s favor. The policemen giggled as they read.

They found the affidavits amusing, just as they found Ansari’s artwork amusing, because of what these things said about life in the Islamic State. Namely, that it was boring. The predictable reality of a terroristic theocracy, like any totalitarian state—the reality ISIS never mentions in its recruitment materials—is boredom. Between bouts of violence and prayer, there’s little to do.

Survivors of ISIS attest to this. As the battle for Qayyarah went on, Iraqis in their thousands fled from surrounding villages and farms. Most were trying to get to the camp near Makhmur. The road there led west through a palimpsest of onetime front lines to an army encampment, where four domed tents, their tarpaulin covers tattered and torn by the wind, had been erected for receiving refugees. A guard tower looked onto a vague expanse of horizon blackened by fires ISIS had set on the Qayyarah oil fields. Some refugees had managed to drive to safety. Around the position were their abandoned cars, now the same color as the desert, some with full suitcases on the seats and jutting from open trunks, all with rolled-up white-cloth flags on the rear dash or white rags tied to the roof racks—the banners of capitulation.

Two men arrived, their faces and limbs covered in black beads of oil mist from the fires. Still they were in high spirits, elated to be safe. A soldier, his brow folded in suspicion, began questioning them.

“May we have some water first?” one asked.

They had swum across the Tigris that morning. ISIS controlled the far bank, and snipers were shooting at anyone who went into the water. Muhammad, the older of the two, had got across first, then hid behind a dune. In the early afternoon he saw the younger man, Abdula, with whom he used to play soccer, emerge from the river. He whistled.

“I hugged him and cried,” Muhammad said.

The worst part about life in the Islamic State, they agreed, was not necessarily the fear—it was the tedium.

“It was like a big prison,” Muhammad said.

“We couldn’t play soccer for two years,” said Abdula.

While Muhammad had a full beard, as ISIS required, Abdula, not yet 20, had only patches of hair on his cheeks. He wore a Chelsea soccer jersey. When ISIS came in, he left school, uninterested in studying the Quran, and in defiance of the new ban on smoking took up selling black market cigarettes. He was jailed twice, his back lashed with a rubber hose both times.

Worse, he hadn’t been able to talk to girls on the phone in all that time. The jihadists were paranoid about phones. They seemed to imagine that a teenage cigarette salesman could call in an American air strike on a knockoff Samsung. Just a few days ago, he said, four men had been publicly beheaded in Qayyarah, allegedly after having been caught with phones. The ridiculous thing was that they were actually allowed to have phones—just not SIM cards, so no one could call or text. Abdula once asked an ISIS patrolman the point of this.

“‘So you can play Islamic anthems on your phone,’ he told me,” Abdula said. Muhammad laughed.

Abdula asked Muhammad if he worried what the army would do to their families. Soldiers were treating all Sunni men as though they were ISIS, he’d heard.

“The Israelis can come,” Muhammad said. “Anything but ISIS. Their favorite thing is blood.”

Abdula was right to worry. He would very likely be taken to a screening center to be interrogated, as many young men fleeing ISIS-controlled territories were. The longer they waited to flee, the more suspicion they raised. Some were kept for a few hours, some for months. One refugee camp near Tikrit is populated by Sunni families who have been there for more than two years.

With every new village freed from ISIS, there are new reports of abuses of Sunnis by soldiers or by Shiite militiamen. The problem seems to be getting worse as the Shiite militias take a greater role in military operations and the line between the army and the militias blurs. Regular army units are becoming increasingly brazen about identifying themselves as Shiite. At checkpoints and encampments, it is commonplace to see flags adorned with heroic portraits of Caliph Ali and Imam Hussein, the seventh-century forefathers of the sect, or posters showing Ali al Sistani, the spiritual leader of Iraqi Shiites, or Muqtada al Sadr, the radical Shiite cleric. If ISIS is defeated in Mosul, the group will be all but finished in Iraq. But after that, Iraqis fear, it will only be a matter of time before another sectarian war erupts.

The battle for Mosul began in October 2016. By February 2017 the Iraqi military had taken the eastern half of the city and had begun operations in the west. It had killed roughly 3,000 militant fighters, according to the generals. It had also lost many of its own men in the process. Just how many is publicly unknown, as the Iraqi government refuses to publish casualty statistics, worrying that the information helps ISIS propaganda.

What didn’t help ISIS propaganda was that for the first time since the Saddam era, Mosul’s residents and Iraqi soldiers were getting along. Indeed they were depending on and helping each other. The battle for the city was taking so long largely because the soldiers were making every effort to protect residents. They were also giving them medicine and food, playing with their kids, buoying their spirits. The residents in turn were cooking for the soldiers, allowing them to use their houses to fight ISIS, giving them tips about the insurgents, and offering them thanks at every opportunity.

View Images The body of an ISIS fighter lies on the outskirts of the front line village of Hajj Ali.

After the nurse Ayham Ali and his family made it to the Fazilia position on the mountain, a medic checked them for wounds. They were given juice and fruit and cookies. They were brought to the main encampment on the front line, where Ali was questioned briefly, and then driven down the mountain to a small compound. Out of the grip of ISIS for the first time in two years, they slept through the night.

The next day Ali was brought into an office and told to sit. He was unrecognizable. Clean-shaven, he wore new pants and a collared shirt. Before him, at a desk, sat a general, while on couches on either side sat officials with the Asayish, the Kurdish intelligence agency.

“We just have to ask you some questions,” the general said.

One of the officials, a stout bald man, led the interrogation, scratching his stomach contemplatively through an unbuttoned gap in his shirt as he spoke. The Asayish had informants in Mosul. It was clear immediately that the interrogator already knew a great deal about Ali. He showed Ali an iPad with a Google Earth image of his street in Mosul and asked Ali to point to his house.

“There’s an ISIS house just nearby,” the interrogator remarked.

Ali was nervous. He knew the fact that he’d waited two years to flee Mosul didn’t count in his favor. Nor did it help that he and his family had moved to Mosul from an outlying village shortly after ISIS took control of the city. He saw there was no point in trying to hide this.

“We left our village because we were worried it would be destroyed in the fighting,” he said.

The interrogator was unfazed. He was more interested in why Ali hadn’t left Mosul after that.

“When ISIS came to Mosul, the routes to Kurdistan were still open, weren’t they?”

“We thought we couldn’t get to Kurdistan,” Ali said. The roads were said to be mined. People who tried to flee were killed.

“Do you know of people from the village next to yours who joined ISIS?” the interrogator asked.

“I know of two men. I know their father’s name. I don’t know their names.”

“And what about from your village?”

“I know all of them.”

“List them.”

Ali paused for a moment.

“My cousin was ISIS,” he said.

Again the interrogator was unsurprised.

“Yes, we know about him.”

Ali explained that he had treated his cousin’s shrapnel wounds. He hadn’t wanted to, but his cousin had insisted. He was ISIS—Ali wasn’t going to refuse.

Ali was asked for phone numbers. He said he didn’t have any.

“I only know these men. It doesn’t mean I worked with them.”

“I know,” the interrogator said. “What about Facebook?”

“I don’t have Facebook. I don’t even have a phone to use Facebook on.”

The interrogator asked about the warden of the ISIS jail Ali was put in, about checkpoints, tunnels, artillery positions. The atmosphere in the room when the questioning was done was not one of relief. It was clear the interrogators didn’t entirely buy Ali’s story. The Asayish knew that many refugees from Mosul lied about their involvement with ISIS. The problem was finding proof. One of the interrogators said privately, “Arabs all lie. All of them have had some connection with ISIS.”

As the interrogation ended, Ali said, “I don’t want to go to a refugee camp. My wife is so young. There may be young men there. They’ll see her.”

“We all have wives,” the general said. “I haven’t seen my wife in six months.”

Ali and his family were driven to a camp. It was newly built, in anticipation of the battle for Mosul. The white tarps of the tents were still intact, the toilets still clean. Ali knew this wouldn’t last. His cousin Tayeb would begin the process of officially vouching for them. Hopefully they would soon move into his house or that of another relative. What he would do after that, Ali had no idea. ISIS had redefined life in Iraq. There would be no return to the past.

“I don’t care if they liberate Mosul,” he said. “I’m never going back.”