Image copyright Getty Images Image caption The former defence secretary voices frustration in his memoir at the "controlling nature" of Mr Obama's White House (file photo)

Former US Secretary of Defence Robert Gates has written a book strongly criticising President Barack Obama's handling of the war in Afghanistan.

In Duty: Memoirs of a Secretary of War, Mr Gates says that the president was sceptical that his administration's Afghan strategy would succeed.

"I never doubted [his] support for the troops, only his support for their mission," Mr Gates writes.

Mr Gates was Pentagon chief under Presidents Obama and George Bush.

He was the first Pentagon head to serve presidents of different parties before leaving political office in 2011.

'Getting out'

Although he describes Mr Obama as "a man of personal integrity" who was right in his decisions regarding Afghanistan, he says that the president was uncomfortable with the wars in Iraq and Afghanistan, which he inherited from the Bush administration.

Was Mr Obama's policy cynical, or did it simply not go as he hoped?

He also says Mr Obama was distrustful of the military that was providing him options.

He writes in the memoir that in March 2011 Mr Obama did not trust Gen David Petraeus - the US military commander in Afghanistan in 2010-11 - and "could not stand" Afghan President Hamid Karzai.

The president "doesn't consider the war to be his", Mr Gates writes of a March 2011 meeting in the White House. "For him, it's all about getting out."

The Washington Post says that the memoir is "in contrast to his subdued, even-keeled public demeanour as Pentagon chief", and that Mr Gates "strikes an often bitter tone in his memoir".

Mr Gates also includes scathing criticism of Vice-President Joe Biden, saying he had been "wrong on nearly every major foreign policy and national security issue over the past four decades".

In response, the National Security Council issued a statement on Tuesday saying Mr Obama relies on Mr Biden's "good counsel" every day, considering him "one of the leading statesmen of his time".

Analysis Robert Gates is seen by many as a consummate professional who served at the Pentagon during one of its most difficult periods. It was a time of two failing wars; the focus not so much on victory but on managing America's withdrawal from the conflicts in terms other than a defeat. But just how difficult his task was is made clear in this autobiography. While much of the attention will focus on his judgements on President Barack Obama, whom he describes as supporting US troops but not the US mission in Afghanistan, perhaps the greatest indictment is of the US governing system itself. Mr Gates speaks of "the excruciating difficulty of serving as a wartime defence secretary in today's Washington. Getting anything consequential done," he says, "was so damnably difficult - even in the midst of two wars". The problems, he notes, were bureaucratic inertia, internal conflicts within the administration and the partisan abyss in Congress.

The former defence secretary voices frustration at the "controlling nature" of Mr Obama's White House, which he says constantly interfered in Pentagon affairs, even though civilian aides lacked knowledge of military operations.

The White House national security staff "took micromanagement and operational meddling to a new level," he writes, comparing their approach to that of the Nixon era of the 1970s.

"All too early in the administration," Mr Gates writes, "suspicion and distrust of senior military officers by senior White House officials - including the president and vice president - became a big problem for me as I tried to manage the relationship between the commander-in-chief and his military leaders."

A former White House adviser, David Axelrod, told NBC News' Today programme he was "surprised" by the criticism in the defence chief's book.

"He always indicated that he had a good working relationship with the president," Mr Axelrod said.

However, Mr Gates does give credit to the president for approving the raid on Osama Bin Laden's compound in Pakistan - which he himself initially opposed - describing it as "one of the most courageous decisions I had ever witnessed in the White House."

He is also effusive in his praise of former Secretary of State Hillary Clinton.