Until late this summer the town of Qaryat Kanhash, in northern Iraq, was a stronghold of the fighters of the Islamic State (ISIS) and one of their last points of defense around the ISIS-controlled city of Mosul. Then, on August 14, as part of a campaign to drive them out, 2,500 of the Kurdish troops called peshmerga swept across Nineveh province from Iraqi Kurdistan and attacked the town from the north and the east.

The peshmerga fired on enemy positions with artillery and rolled through the streets of Qaryat Kanhash in tanks and armored personnel carriers. US jets swooped in, destroying Islamic State vehicles, command-and-control centers, and barracks with precision air strikes. In two days, the Kurdish forces and their American allies killed one hundred ISIS fighters and sent the remaining two hundred fleeing thirty miles west to Mosul. The Kurds lost fifteen men—all killed by ISIS snipers firing from the top floors and rooftops of a hospital, a school, and other public buildings.

Ten days after the fighting, two peshmerga fighters agreed to take me on a tour of the battlefield. We met in 110° heat at the Black Tiger base, a dusty military camp west of Erbil, the main city of Iraqi Kurdistan. The camp is named after its commander, Sirwan “Black Tiger” Barzani, a mobile phone company magnate and the nephew of the Kurdish president, Massoud Barzani, who earned the name while fighting against Saddam Hussein’s forces in the mountains in the 1990s. Just inside the entrance to the camp, Barzani’s fighters had piled a dozen burned and bullet-riddled pickup trucks. They were ISIS suicide vehicles, I was told, intercepted and shot to pieces as they sped toward Kurdish military checkpoints inside the town.

We crossed a badly damaged bridge over a canal leading from the Tigris—patched together by the Kurds after ISIS engineers had blown it up—and drove down the road into Qaryat Kanhash. Except for soldiers, the town was deserted: the peshmerga had evacuated the civilians to a nearby camp for displaced persons. Engineering teams were inside houses, searching for booby traps. Small red warning flags surrounded the improvised explosive devices (IEDs) on the roadside.

Moments after we arrived a thunderous explosion rocked the town when peshmerga engineers blew up a cache of ISIS bombs in a controlled detonation; thick smoke rose from inside a building a hundred yards away. A second explosion sounded just behind a barren brown hill half a mile to the north, followed by another…