The White House sought to contain the damage Wednesday from former Defense Secretary Robert Gates’s memoir, insisting that behind-the-scenes clashes were by design and President Obama was always committed to his strategy for Afghanistan. 

Press secretary Jay Carney stressed that Obama had intentionally assembled a “team of rivals” with diverging views, while former aides took to the airwaves to defend both the president and Vice President Biden.

In his book, early excerpts of which were published by some media organizations on Tuesday, Gates accused the president’s advisers of taking “micromanagement and operational meddling to a new level.”

Gates alleged that Obama did not believe in his own strategy in Afghanistan and that, for him, it was “all about getting out.”

The charges threaten to tarnish Obama’s foreign policy legacy at a time when the administration is trying to negotiate a long-term security agreement in Afghanistan and deal with evolving threats in the Middle East.

Critics of Obama’s foreign policy have assailed the president for the resurgence of al Qaeda affiliates in Iraq and say Gates’s assessment shows the president ignored the Pentagon’s advice.

“He should have just said I ran to end the war in Iraq, and I’m going to do it, and I don’t want to hear from my commanders,” Sen. Lindsey Graham (R-S.C.) said Wednesday.

“But now they’re trying to blame the Iraqis,” Graham said, referring to the White House’s assessment that a postwar deal couldn’t be reached due to a dispute about troop immunity.

Carney faced a barrage of questions about Gates’s book and repeatedly said the president “expects to hear competing points of view from every member of his national security team.”

He argued that Obama had intentionally assembled a “team of rivals” — invoking the title of a book on President Abraham Lincoln’s Cabinet — and that “robust” debates and occasional frustrations were a natural byproduct.

“When you pick a team of rivals, you do so because you expect competing points of view,” Carney said.

Carney noted that Gates ultimately praised the president’s decisions on Afghanistan policy in other excerpts from the book.

And in response to perhaps the most serious charge — that Obama ordered troops into battle without conviction — Carney said the president “believes thoroughly in the mission” and was “extremely conscious of the responsibility” involved in sending people to a war zone.

The president has “great faith in the troops that carry out the mission and the mission itself,” Carney said.

Former top officials also defended Obama on Wednesday, pushing back against Gates’s claims and questioning his motivations.

Former White House chief of staff Bill Daley said Gates shouldn’t have released his memoir while the war in Afghanistan is still being fought.

“It’s one thing as historians look back on an administration, but in the middle of it, when you’re pursuing a war at the same time, and one that is controversial with the American people and has been very difficult on our military, I think it’s just a disservice to be very frank with you,” Daley said Wednesday on CBS’s “This Morning.”

David Axelrod, another former White House adviser, on Wednesday said Obama was “very committed” to the fight in Afghanistan.

“I don’t think that is true” to say otherwise, Axelrod said on NBC’s “Today,” adding that it always seemed Obama and Gates had a good working relationship.

Many of Gates’s complaints in the excerpts focus on the White House and Obama aides having too much control over national security and defense policy.

The passages underscore the tensions between the military and the White House on national security decision-making, such as postwar Iraq, the size of the surge in Afghanistan and whether to strike Syria last year.

Obama reportedly changed his mind about missile strikes in Syria, for instance, after a conversation with his chief of staff, Denis McDonough, catching military leaders off guard.

Some former administration officials say Gates is simply telling it like it is.

One former Defense official who served in the Obama administration said Gates’s observations were “100 percent accurate.” 

The official said Obama’s former national security adviser Tom Donilon and his special assistant Samantha Vinograd “saw the Pentagon as the enemy.”

According to the official, former Undersecretary of Defense for Policy Michele Flournoy once sent Donilon a memo in 2012 telling him that she felt the White House was purposely shutting the Pentagon out of important meetings on Afghanistan. 

“Donilon got mad because she dared to put her concerns in writing,” the official said. 

J.D. Gordon, a retired Navy commander and former Pentagon spokesman under Gates, said it wasn’t surprising that Gates waited until he left the administration to raise his concerns, given his CIA and military background.

“Secretary Gates spent a career in the CIA where, like the military, directly challenging your bosses is not part of the culture,” Gordon said. “He is also a very mild-mannered, non-confrontational and deeply private individual.”

Gordon also agreed with Gates’s assessment of the tensions between the military and White House.

“As a former Pentagon spokesman for 4 years, to include during the first 9 months of the Obama administration, I believe the whole building sensed the enormous attitude shift between the Bush and Obama White House,” he said.

“I got the sense that President Obama and his inner circle personally distrusted the military and immediately looked for ways to make it a smaller, weaker and more progressive institution.”

One former national security official said the number of people at the White House with access to sensitive deliberations has grown.

“Those meeting have changed over the years. It used to be just about the principals. Now there’s a lot of backbenchers; now there’s a lot of people taking notes, things that were just forbidden. ... It’s just all changed.”

The book is certainly sparking discussion at the Pentagon, even though Defense officials aren’t commenting on it officially beyond the White House statements.

One Defense official told The Hill: “His opinion is important, but it’s one man’s opinion.”

Amie Parnes contributed. 

This post was updated at 8:30 p.m.