WASHINGTON (CNN) -- Former Defense Secretary Robert Gates set off shock waves in Washington with accounts from his upcoming memoir, in which he unleashes blistering criticism of Congress and his former colleagues in the Obama administration.
He also claims the President lost faith in his own Afghanistan policy.
Gates' comments come in his memoir "Duty: Memoirs of a Secretary at War," which was obtained by CNN but set to be released next week.
In the book, Gates writes, "[Obama] eventually lost faith in the troop increase he ordered in Afghanistan, his doubts fed by top White House civilian advisers opposed to the strategy, who continually brought him negative news reports suggesting it was failing."
A Republican appointee of President George W. Bush who stayed on into Obama's administration, Gates also writes of a pivotal 2011 meeting in which Obama questions the abilities of Gen. David H. Petraeus.
"As I sat there, I thought: The president doesn't trust his commander, can't stand Karzai, doesn't believe in his own strategy and doesn't consider the war to be his...For him, it's all about getting out," Gates writes.
A source familiar with White House thinking on how to respond to Gates' memoir told CNN that White House officials have been in meetings on the issue and were reaching out to allies to defend the President against the claims.
The source said they are being careful not to attack Gates directly, thinking that will backfire.
Officials believe Obama's foreign policy legacy is strong because of his Afghanistan policies and the killing of Osama bin Laden, and that Gates' accusations don't hurt with the Democratic base.
A White House official called attention to two parts of the book that reflect positively on the President. Gates said of Obama's chief Afghanistan policies, "I believe Obama was right in each of these decisions."
"I never doubted Obama's support for the troops," Gates writes. The official, however, did not highlight the rest of the sentence, which says "only his support for their mission."
A former White House official contested the excerpts saying, "I thought the President was a close ally of Gates. It's disappointing, because if Gates had issues you would've expected him to raise them. When I spoke to Gates about the president he was always effusive."
National Security Council spokeswoman Caitlin Hayden said the President "deeply appreciates Gates' service" and is open to differing points of view from his national security team.
"Deliberations over our policy on Afghanistan have been widely reported on over the years, and it is well known that the President has been committed to achieving the mission of disrupting, dismantling and defeating al Qaeda, while also ensuring that we have a clear plan for winding down the war, which will end this year," Hayden said in response to the comments.
A senior U.S. military official involved in some of the events described in the book expressed dismay with Gates, telling CNN that if Gates had been in uniform and felt that the President and his staff were deficient, he would have had an obligation to resign. He noted some may feel Gates also had the same obligation given that he signed orders sending troops off to war.
This official was directly involved in Afghanistan troop surge discussions. He was adamant the military commanders did not "game" the President on the numbers, but they came to realize Obama felt that way.
Republican Sen. Jeff Flake tweeted in response to reports of the memoir, criticizing the timing of the former defense secretary's comments.
Criticism of Hillary Clinton, Joe Biden
Gates was also critical of Hillary Clinton and Joe Biden, recounting a conversation between Obama and Clinton suggesting political motives for their positions on Iraq.
"Hillary told the president that her opposition to the  surge in Iraq has been political because she was facing him in the Iowa primary," Gates writes. "The president conceded vaguely that opposition to the Iraq surge had been political. To hear the two of them making these admissions, and in front of me, was as surprising as it was dismaying."
The former White House official responded, "President Obama evaluated the merits of the surge but his opposition to it was not political, rather in line with his thought that more of the same was not the right path."
Of Biden, Gates wrote, "I think he has been wrong on nearly every major foreign policy and national security issue over the past four decades."
Hayden said Obama disagrees with Gates' assessment of Biden and hailed the Vice President as "one of the leading statesmen of his time."
Criticism of Congress more severe
For as scathing as Gates was in describing the Obama administration, the former defense secretary said none of the difficulties he had with the executive branch "compared with the pain of dealing with Congress," a body he describes as phony, self-centered and narrow-minded.
"Congress is best viewed from a distance -- the farther the better -- because up close, it is truly ugly," Gates wrote in a piece in the Wall Street Journal, which was adapted from his book.
"I saw most of Congress as uncivil, incompetent at fulfilling their basic constitutional responsibilities (such as timely appropriations), micromanagerial, parochial, hypocritical, egotistical, thin-skinned and prone to put self (and re-election) before country."
Gates opened the piece by writing that in the numerous times he testified before Congress, he found himself "tempted to stand up, slam the briefing book shut and quit on the spot" because of the "rude, insulting, belittling, bullying and all too often highly personal attacks" one has to endure during congressional testimony.
He said if he had done so, he would have told Congress, "I may be the secretary of defense, but I am also an American citizen, and there is no son of a bitch in the world who can talk to me like that."
"Members postured and acted as judge, jury and executioner," he wrote.
His hypothesis as to why so many members "were in a permanent state of outrage:" The members must have "suffered from some sort of mental duress that warranted confinement or at least treatment for anger management."
Another congressional thorn in Gates' side brought to light in his opinion editorial is how Congress handled deciding which defense instillations and bases to close during budget tightening.
Gates wrote that "any defense facility or contract in their district or state, no matter how superfluous or wasteful, was sacrosanct," even if the member had "stridently attacked the Defense Department as inefficient and wasteful."
Why he wrote the book—now
Critics of the memoir blasted Gates for publishing the critique in the middle of the Obama's second term, saying the more appropriate move would have been to wait until after his former boss leaves the White House in 2016.
A source close to Gates noted that he's a historian by nature and wanted to document what went on but didn't want to wait because he believed the content of his book is all still relevant and should be discussed real time, especially issues of war and the troops.
The dysfunction in Washington and the way commanders and generals were treated really upset him, the source added.
Gates disagrees that his decision to release the book now is disloyal. In fact, he believes just the opposite and stands by all of it, the source said.
As for Gates' stinging criticism of Congress, the source said Gates had the most disdain for the House Foreign Affairs Committee, though he didn't give specific names of lawmakers.
-- CNN's Brianna Keilar, Barbara Starr, Dana Bash, Dan Merica, Dana Davidsen and Ashley Killough contributed to this report.
™ & © 2014 Cable News Network, Inc., a Time Warner Company. All rights reserved.