“When I took this job, the United States was fighting two very difficult, very costly wars,” Mr. Gates said. “And it has seemed to me: Let’s get this business wrapped up before we go looking for more opportunities.”
“If we were about to be attacked or had been attacked or something happened that threatened a vital U.S. national interest, I would be the first in line to say, ‘Let’s go,’ ” Mr. Gates said. “I will always be an advocate in terms of wars of necessity. I am just much more cautious on wars of choice.”
Most recently, he expressed major reservations about American intervention in Libya.
In December 2006, Mr. Gates was brought on by President George W. Bush to fix Iraq, and he was kept on by President Obama to solve Afghanistan. Even as a trained historian, he said, he has learned most clearly over the last four and a half years that wars “have taken longer and been more costly in lives and treasure” than anticipated.
As Mr. Gates, 67, gets ready to return to private life at the end of the month, the futures of those two countries seem far from certain.
In the interview, Mr. Gates was asked to confirm reports of policy duels during the two years before Mr. Bush and Vice President Dick Cheney left office, a time in which he was said to have been successful in altering policies or blocking missions that might have escalated into another conflict.
“The only thing I guess I would say to that is: I hope I’ve prevented us from doing some dumb things over the past four and a half years — or maybe dumb is not the right word, but things that were not actually in our interest,” Mr. Gates said.
Pressed to offer more details, Mr. Gates smiled and said, “I will in my book.”
Some of the defense secretary’s confidants, however, confirmed that Mr. Gates prevented provocative, adventurist policies against Iran, in particular, that might have spun into war.
“He’ll be remembered for making us aware of the danger of over-reliance on military intervention as an instrument of American foreign policy,” said former Senator David L. Boren, who, during his tenure as chairman of the Senate Intelligence Committee, developed a rapport with Mr. Gates when he was director of central intelligence in the early 1990s.
“I also think that he prevented further adventures, particularly in our relationship with countries like Iran, that could have turned into military intervention had he not become secretary of defense,” said Mr. Boren, who is now president of the University of Oklahoma. “I think that he stepped us back from a policy of brinkmanship.”
Mr. Gates, the first defense secretary to work for two presidents of different parties, said he managed the transition from Mr. Bush to Mr. Obama by using a lesson he had learned through various changes of directors at the C.I.A.: “As a holdover, for the first while, don’t talk too much.”
Or, as Mr. Gates elaborated, “Avoid saying, ‘Well, we tried that before,’ or ‘We’ve thought about that,’ or ‘We’ve been down that road and that won’t work.’ Those things always get under people’s skin when they come in.” He concluded that, “frankly, it took a lot of Washington experience to make it work.”
Mr. Gates spoke in his spotless, nearly paper-free Pentagon office, which has sweeping views of the Washington Monument, the Lincoln Memorial and the pleasure boats moored in a Potomac River marina. He was relaxed, although not especially expansive in the midst of a flurry of “lasts” in recent weeks — the last trip to Afghanistan, the last hearing before Congress, the last news conference, a series of last interviews with reporters.