Updated

President Obama says former Secretary of Defense Robert Gates did an outstanding job while at the Pentagon and calls him a good friend.

Obama responds to Gates' book, "Duty: Memoirs of a Secretary of War," saying that his administration's policy in Afghanistan was the right one. In his book, Gates questions Obama's commitment to his war policy and details discord among the team that made key decisions about the wars in Iraq and Afghanistan.

Obama says that part of his job as commander in chief is to, quote, "sweat the details" on policies that send men and women into harms' way.

Obama spoke Monday as he concluded a meeting with Spanish Prime Minister Mariano Rajoy.