The legacy of David Petraeus is difficult to extricate from the politics of the moment. Praise Petraeus' performance as a division commander or counterinsurgency visionary, and you're bashing George W. Bush. Praise his performance as commander of the Iraq surge, and you're apologizing for Bush or the Iraq war. Praise his performance as commander in Afghanistan, and you're undermining Barack Obama. Criticize him for any of these things, and you're pushing the opposite points.

During the national security debates of the 9/11 era, Petraeus has been a cipher for all of these positions, frequently co-opted – or derided – by opportunistic politicians and journalists. As he rose higher in the military, he wasn't above playing along at times. That media presentation often overlooked a basic fact – one that looks clear on Wednesday as Petraeus retires from the Army. Even while his greatest successes revealed his flaws, Petraeus really was that good .

Are the arguments over the Iraq surge over yet? When Petraeus took command in Iraq in 2007, the war looked unsalvageable, with 2000 Iraqis dying violent deaths (.PDF) just in Baghdad every month. By focusing on the "belts" around the capitol, assigning newly-arrived troops to live in dangerous neighborhoods, and forcibly separating combatants by building controversial walls, Petraeus cut the death rate in half by summer's end. That's when the debate really intensified.

Yes, Petraeus is not solely responsible for the decline in violence. He capitalized on a historic blunder by al-Qaida, who grabbed defeat from the jaws of victory by violently alienating the very Iraqi Sunnis it needed for support. But Petraeus' critics who make that point aren't diminishing the general's achievements as much as they might think. Unlike his predecessors in command – or at the Pentagon – Petraeus had the foresight to embrace the Sunni Awakening, even though it contained ex-insurgents with American blood on their hands.

Remember that the Bush administration's strategy for Iraq (.PDF) didn't ever envision aligning with Sunni insurgents against al-Qaida. In the absence of strategic guidance from his civilian commander, Petraeus improvised, relying on his understanding of counterinsurgency that he pushed on the Army during his 2005-6 interregnum running the Combined Arms Center at Fort Leavenworth. It yielded the best outcome that the United States could have experienced in Iraq.

That was Petraeus' style as a general. In 2003, when he commanded the 101st Airborne Division in Mosul, he essentially ignored the Bush administration's decree to fire the remnants of Saddam Hussein's government, which ran the bureaucracy. The result was that Mosul remained relatively secure while disenfranchised Sunnis around Iraq formed an insurgency. Another, more problematic result was that Petraeus, a two-star general, "had his own foreign policy," in the words of war chronicler Tom Ricks. Petraeus isn't just a general, he's a cautionary tale of civilian-military relations.

The Gamble, Ricks' account of the surge, judges that Petraeus essentiallyredefined the aims of the Iraq war without publicly acknowledging it. Bush wanted to defeat the insurgency and negotiate an enduring U.S. presence in Iraq. Petraeus, Ricks argues, sought to diminish the insurgency to the point where the U.S. could get most of its troops out while saving face. It's one thing for a general to see things differently from his commander. But it's quite another for him to subtly reinterpret the aims of a war. If the media hasn't fully accepted Petraeus' denials that he's running for president, maybe it's because he sometimes acted like he already was the commander in chief.

That may have cued up Petraeus' status as a cipher for America's wars and the presidents presiding over them. Ricks considers the surge a "strategic failure" because it didn't yield Bush's intended effect of Iraqi political reconciliation. But that can't really be placed on Petraeus' shoulders – even as Petraeus tried to redefine reconciliation in September 2007 to argue it was already happening, providing Bush with cover.

Nor was it Petraeus' role to retroactively justify the Iraq war through the surge. Logically speaking, whatever you think of the wisdom of the Iraq invasion and occupation doesn't change with the surge. At best, the surge's accomplishment was to mitigate the war's negative consequences, not erase them.

That's in keeping with best counterinsurgency practices. Petraeus' time in command in Baghdad is surely his crucible. His most lasting legacy, however, wasn't forged in the deserts and urban battlefields of Iraq, but the classrooms of Fort Leavenworth. During his time running the Combined Arms Center, one of the Army's most important educational institutions, he instituted coursework in counterinsurgency for mid-career Army officers, most of whom were either Iraq and Afghanistan veterans or would soon be.

Below the radar, Petraeus directly influenced a generation of Army officers. He gave them an intellectual roadmap – counterinsurgency – that's now ubiquitous throughout the service. Many of those majors are now colonels, on their way to becoming the generals of the future. Sure, Petraeus spearheaded the Army/Marine Corps Field Manual on Counterinsurgency at Fort Leavenworth in 2006, the rare military document that became a cultural phenomenon. But more importantly, he had already created the internal, institutional audience for it.

"Him focusing energy on it got the debate going across the institutional Army," says retired Col. John Agoglia, who spent the last three years directing the Counterinsurgency Training Center in Kabul. "It allowed the soldiers, the officers coming back from Iraq and Afghanistan to see that the Army was working hard to contextualize their experience, so they weren't on their own."

Time will determine whether that influence was ultimately positive. Counterinsurgency doesn't lack for critics. The manual's famous invocation that counterinsurgency is the "graduate level of war" strikes many in the Army as arrogant. Internal skeptics like Col. Gian Gentile contend that it's a tactical and operational approach masquerading as a strategy. Others fear its contention that insurgencies don't have military solutions leaves the Army de-emphasizing soldiering and stressing social and economic development, which are properly civilian tasks. Another criticism is that policymakers' fascination with the possibilities of counterinsurgency risks enmeshing the U.S. in more grueling, bloody ground wars. With the wars of the future looking likely to occur in sea, air, space and cyberspace, a generation of Army officers forged in counterinsurgency – critics call it a cult – will be challenged to adjust.

Petraeus is hardly without his failures. His overlooked time training the Iraqi military in 2004-5 didn't yield a competent fighting force – something that might have hobbled the career of a commander who wasn't as beloved by the press – and under his watch, nearly 200,000 weapons for the Iraqis went missing. The Afghanistan war he unexpectedly commanded hasn't been a repeat success: violence remains roughly at pre-surge levels, despite Petraeus switching up his counterinsurgency emphasis onto killing and capturing Taliban leaders. Petraeus spent a lot of time spinning the war without winning it. And as a soldier who blurred the line between executing strategy and creating it, his legacy on civilian-military relations will be debated well into the future.

But now that the CIA's drone strikes are effectively the main U.S. counterterrorism effort, increasingly indistinct from a military operation, it's perhaps natural that Mr. Petraeus will run the CIA. Out of uniform and in the shadows, he'll still play a leading role shaping American strategy in a sprawling war that has defined him and which he himself has largely defined. At Langley, Petraeus will surely become a cipher and a proxy for a new security debate: the efficacy and wisdom of the new U.S. shadow wars.

But Adm. Mike Mullen, the chairman of the Joint Chiefs of Staff, told the crowd at Fort Myer for Petraeus' retirement ceremony that Petraeus had set "the gold standard for wartime command in the modern era." Compared to that judgment – one that's difficult to refute – whatever debate and controversy Petraeus continues to generate is mere noise.

Photo: Spencer Ackerman

See Also:- David Petraeus: The Danger Room Interview