Robert Gates is the only U.S. secretary of defense to have served two presidents from different political parties in a time of war. So his comparison of two men facing their greatest wartime crises -- one in Iraq, the other in Afghanistan, both weighing the case for troop reinforcements to salvage wars that were being lost -- is invaluable.

Gates’s observations, contained in his new memoir, have provoked debate about the different styles of George W. Bush and Barack Obama (that’s what people in Washington, predictably, have focused on). The book’s more constructive message, however, is about the tension that is essential to the relationship between the commander in chief and the military.

Consider: Gates credits Bush’s determined leadership during the Iraq surge of 2007, and he commends a national-security process and staff that granted the Pentagon and top commander General David Petraeus great autonomy in executing a new counterinsurgency campaign. Gates agrees with the decision to send heavy reinforcements to Iraq, and he says it succeeded in helping stabilize the country.

Problem is, the surge was necessary to avert disaster -- and the errors that brought the war to that point were made under the same commander in chief. Gates writes approvingly about how Bush enjoyed the company of senior military members and relied on their advice. That worked after 2006, when Gates took office, but for the previous four years, Bush had failed to challenge their half-baked strategy of handing off security responsibilities to unprepared Iraqi forces. By the time Gates arrived, Bush’s regard for his military commanders had brought Iraq to the brink of implosion.

Fast-forward to 2009, and Gates is seething over Obama’s vacillations over his own Afghan strategy. Gates sharply criticizes the lack of respect shown to top uniformed leaders by Obama’s national-security team. He says the national-security process was micromanaged by a White House that was “by far the most centralized and controlling … since Richard Nixon and Henry Kissinger ruled the roost.”

Yet he also shows that this skepticism -- of both tactics and strategy -- was justified. After pocketing the 25,000 extra soldiers that Obama sent to Afghanistan in early 2009, the top U.S. military commander surprised even Gates in requesting another 30,000 to 40,000. Meanwhile, the civilian leadership’s doubts about the military’s overall strategy were increasing. “The president doesn’t trust his commander,” Gates remembers thinking, “doesn’t believe in his own strategy, and doesn’t even consider the war to be his,” as he writes in one of the most widely quoted passages from the book. “For him, it’s all about getting out.”

A tough assessment -- yet in the end, and to his credit, Gates recognizes that Obama got the substance of the Afghan strategy right. The long fight over that strategy in the Obama administration, he writes, “led to a helpful, steady narrowing of our objectives and ambitions.” Had Obama been more compliant -- if he’d enjoyed the company of military commanders more, maybe -- that might not have happened.

The civil-military relationship is inevitably fraught in wartime. Managing it well requires presidents to convey -- and possess -- respect for the military while also holding the national-security apparatus to account, not least by asking tough questions of the generals. The real value of Gates’s memoir is showing not only how hard but also how vital it is for presidents to strike that balance.

To contact the Bloomberg View editorial board: view@bloomberg.net.