Updated 5:40 p.m. ET, 1/13/2014
(CNN) - President Barack Obama, speaking for the first time since news outlets obtained copies of former Defense Secretary Gates' book, which was critical of the commander in chief, said Monday that Gates did an "outstanding job" during his time in his administration.
"War is never easy and I think all of us who have been involved in that process understand that, but I want to emphasize that during his tenure here Gates was an outstanding secretary of defense, a good friend of mine and I'll always be grateful for his service," Obama said.
In his memoir, "Duty: Memoirs of a Secretary at War," set to be published this week, Gates writes that Obama questioned his own policy in Afghanistan.
Obama notes, as Gates does in the book, that he and the defense secretary developed the strategy for Afghanistan. The President maintained, however, that it was the appropriate action to take and one that his administration will continue to follow.
"It think that what's important is that we got the policy right, but that this is hard and it always has been," Obama said.
"Whenever you've got men and women that you are sending into harm's way after having already made enormous investments in blood and treasure in another country, than part of your job as commander in chief is to sweat the details on it and recognize that there are enormous sacrifices that are being made and you're constantly asking yourselves questions about how you can improve the strategy."
Obama made the comments in the Oval Office during a bilateral meeting with President Mariano Rajoy Brey of Spain.
On Sunday, Gates defended his book against criticism faulting him for his harsh comments about an administration in which he recently served, saying that the polarizing political culture in Washington was quick to focus on the negative comments he wrote about the President, instead of the positive remarks also included in the book.
CNN's Dana Davidsen contributed to this report.