By the time he was appointed the top commander in Iraq in 2007, Petraeus had learned from his earlier mistakes as the head of the mission to train Iraq’s security forces. Mosul, the city that he had successfully pacified for a year at the beginning of the war, had fallen apart; his improvised tactics had done some good, but couldn’t survive transition to a new commander. Petraeus had churned out hundreds of thousands of hastily trained but well-armed police officers and soldiers, following orders to stand up indigenous forces of any quality so that America could stand aside. Once the Iraqi civil war heated up, these sloppily mustered forces deserted, defected or joined death squads. But now that he was in charge, he adopted as his strategy the Army field manual he had just written, and surrounded himself with old friends and mentees.

Petraeus and his merry band changed tactics, mobilizing a counterinsurgency network to pursue extremists with force, but spending most of their resources protecting Iraqi civilians from carnage. Petraeus got extra troops. And he benefited from significant developments completely beyond his control: Sunni tribes broke with Al Qaeda in Iraq, while the most formidable Shiite militia, the Mahdi Army, declared a unilateral cease-fire so its leader could purge rogue units.

President Bush had promoted the COINdinistas because they were flexible, pragmatic problem solvers and because he had a nagging problem on his hands: how to get out of Iraq without looking defeated. Counterinsurgency was just one part of the fortuitous mix that yielded a just-good-enough resolution for Iraq. Petraeus and the officers and experts had been right about how to fight in Iraq and reached plum positions in the Pentagon. But they overestimated themselves. They fancied they were inventing a new way of war and casting out the demons of a moribund Pentagon. In fact, they were doing something far less grandiose.

After President Obama took office, he adopted counterinsurgency strategy for Afghanistan, and made Petraeus the commander in that war. Yet by then, as Kaplan persuasively argues, counterinsurgency doctrine had calcified into dogma. COIN was just one tool in a great power’s kit, not a one-size-fits-all solution, and in Afghanistan it made no sense at all. A counterinsurgency requires a long commitment, 10 years or more, and great numbers of troops, but the United States intended to pull out after a quick, small surge. Moreover, the Afghan government shared almost none of America’s goals, making the war’s mission untenable.

Kaplan damningly portrays a group of military officers and outside experts who cynically recommended a troop surge and a switch to counterinsurgency tactics in Afghanistan even though, he claims, they were skeptical that any strategy could actually stabilize the country. A formulaic Petraeus rambled on about his glory days in Iraq, even during meetings with the Afghan president, Hamid Karzai, drawing warnings from his no-longer-fawning subordinates. He left with an aura of failure, and Obama, having been boxed in by his generals to escalate in Afghanistan, ultimately outmaneuvered them, calling their bluff and ordering a drawdown. The lesson of the COINdinistas’ subversive struggle in the bureaucracy and their brief heyday was that you can’t want victory more than the foreign government you’re trying to prop up.

Kaplan’s narrative ends before the news of Petraeus’s embarrassing and career-halting extramarital affair, but the denouement of “The Insurgents” is sadder and certainly far more consequential.

The COIN brigade forced the Army to adapt, to become what one officer called “a learning organization,” but the Pentagon failed to grasp the most important lesson of the decade: that the military does best when it can learn new types of missions quickly, whether delivering aid after a tsunami, stabilizing a failed state or running covert missions against international terrorist rings. Instead, it exchanged an old dogma for a new one. Once persuaded that the military could do counterinsurgency, few in Washington stopped to think about when it should do it. “Petraeus had stressed the importance of getting ‘the big ideas’ right, but the ideas in COIN theory weren’t as big as he seemed to believe,” Kaplan writes.

Obama has ordered the Pentagon to preserve the lessons of counterinsurgency and stability operations in case they’re needed in the future, but Kaplan reports that the president has also ordered that minimal manpower or matériel go toward preparing for resource-draining exercises in counterinsurgency and nation-building. The counterinsurgency cult was more than a fad, Kaplan establishes. But it was much less than a revolution.