n the weeks since Petraeus’s resignation, some of his detractors have argued that his accomplishment in Iraq was merely to put an acceptable face on defeat. This is absurd. Petraeus was asked to shepherd a disastrous war; his achievements are real and substantial, and shouldn’t be obscured by something as irrelevant as an extramarital affair. By 2006, Iraqi society was disintegrating, and there were growing signs that the country’s neighbors—Iran, Saudi Arabia, Turkey, Syria—were preparing to intervene more forcefully. It seemed possible that Iraq would implode and take the whole region down with it. If Petraeus and his band had not got their chance—and, reading Kaplan’s book, it seems a miracle that they did—things could have gone terribly worse.

So how much of Petraeus’s success was due to Petraeus? He was smart, and he was diligent, but was that enough? “I have plenty of clever generals,’’ Napoleon purportedly said. “Just give me a lucky one.” Indeed, the crucial lesson of the surge is that it succeeded only because other things in Iraq were changing at exactly the right time. The most important of these was the Awakening, the name given to the cascading series of truces made by Sunni tribal leaders with their American occupiers. Many Sunnis were appalled by the sectarian attacks—and were also fearful of genocide at the hands of the Shiite death squads. They asked the Americans for help, and U.S. officers, sensing a chance to turn the tide against Al Qaeda, seized the opportunity.

By the time Petraeus arrived, the Awakening had already begun. Still, he made the decisive choice not just to make peace with the former insurgents but to pay them not to fight us. The program, called the Sons of Iraq, put a hundred thousand gunmen, most of them Sunni former insurgents, on the payroll, for three hundred dollars a month each. The idea strongly echoes the Army’s counter-insurgency field manual, drafted under Petraeus’s supervision: “Offering amnesty or a seemingly generous compromise can also cause divisions within an insurgency.” In this case, at least, it was a genteel way of describing old-fashioned baksheesh. By the end of 2007, the Americans were holding bicycle races with their former enemies…

What does all this mean? For one thing, it made Petraeus’s success in Iraq very Iraqi; that is, hard to export.