At the Armed Forces Farewell Tribute on the Pentagon’s parade field today, Gates thanked President George W. Bush for nominating him for the job in 2006, and President Barack Obama for retaining him in it during the change in administrations in 2009.

At the ceremony, Obama praised Gates’ bipartisanship, and awarded him the Presidential Medal of Freedom -- the highest award a president can confer to a civilian.

Gates also spoke to those who would have the United States withdraw from world affairs and retreat to isolationism. He took the thought from former Defense Secretary and Army Chief of Staff during World War II General of the Army George C. Marshall. Gates said that once while addressing university graduates, Marshall extolled what he considered the great “musts” of that generation.

Marshall said the musts included the development of a sense of responsibility for world order and security, and the development of a sense of the overwhelming importance of America’s acts and failures to act.

“Now, as when Marshall first uttered those words, a sense of America’s exceptional global responsibilities and the importance of what we do or do not do remain the great ‘musts’ of this dangerous new century,” Gates said. “It is the sacred duty entrusted to all of us privileged to serve in positions of leadership and responsibility; a duty we should never forget or take lightly; a duty I have every confidence you will all continue to fulfill,” he added.

Gates said his service as secretary of defense “has been the greatest honor and privilege of my life, and for that I will always be grateful.”

The transition from the Bush to the Obama administration was the first during war in nearly 40 years, Gates said, and it showed how serious people in both parties came together to do good for the country.

“The collegiality, thoroughness and professionalism of the Bush-Obama transition were of great benefit to the country and were a tribute to the character and judgment of both presidents,” he said.

When Gates arrived in the Pentagon in December 2006, Marine Gen. Peter Pace helped shepherd him through the intricacies of the building, and Gates thanked Pace, the chairman of the Joint Chiefs of Staff at the time, for his help.

Gates also thanked his “battle buddy,” the current chairman of the Joint Chiefs of Staff, Navy Adm. Mike Mullen.

“Without Mike’s advice to me, his effective leadership of the uniformed military and our close partnership, the record of the last several years would, I think, have been very different,” the secretary said. “Mike was never shy about disagreeing with me, but unfailingly steadfast and loyal to me and to the presidents he served once a decision was made. He is the epitome of a military leader and officer, a man of supreme integrity, a great partner and a good friend.”

Gates said he benefited from the great team in the department when he arrived, and the great team that came in under the Obama administration. He thanked the political appointees of both parties and the career civil servants for their efforts in the Pentagon to provide for those serving on battlefields in Iraq and Afghanistan.

Gates also stressed the need for cooperation among federal agencies. He specifically pointed out the productive and warm relationship between the State Department, DOD and the intelligence community.

“The blows struck against al-Qaida, culminating in the [Osama] bin Laden raid, exemplify the remarkable transformation of how we must fuse intelligence and military operations in the 21st century,” he said.

Gates said his views on cooperation with The State Department have evolved over his four decades of government service. When he began his public service career in 1966, he said, the secretaries of state and defense barely spoke.

“In the case of Secretaries [Condoleezza] Rice and [Hillary Rodham] Clinton, I have not only been on speaking terms with these two formidable women, we’ve also become cherished colleagues and good friends,” he said.

Gates also testified before Congress on the need for more money for the State Department. “We should never forget that diplomats and development experts from State and [the Agency for International Development] are taking risks and making sacrifices in some of the planet’s least hospitable places,” he said. “And I speak for all our military in appreciating the contributions they are making every day to the success of our missions in Afghanistan, Iraq and elsewhere around the globe.”

The secretary thanked his wife, Becky, for her help and support. When President Bush asked Gates to be the secretary, he asked his wife what she thought.

“I was really wrestling with the decision and finally told her she could make it a lot easier if she just said she didn’t want to go back to D.C.,” Gates said. “She thought a moment and replied, ‘We have to do what you have to do.’ That is something military spouses have said in one form or another a million times since 9/11 upon learning that their loved one received a deployment notice or is considering another tour of service.

“She made it easy for me to say yes to this job, to do what I had to do to answer the call to serve when so much was at stake for America and her sons and daughters in two wars,” he added.

Gates has spent much of the last few months visiting with American service members around the world. He has put a farewell message out to the troops.

“Though I was only able to meet a small sample of those who deployed downrange, it was important to meet, to look them in the eye one last time and let them know how much I care about them and appreciate what they and their families do for our country,” he said. “I’ll just say here that I will think of these young warriors -- the ones who fought, the ones who keep on fighting, the ones who never made it back -- till the end of my days.”

Gates praised his successor as secretary, Leon E. Panetta, who will be sworn in as the 23rd defense secretary tomorrow.

“This department and this country are fortunate that a statesman of Leon Panetta’s caliber and experience has agreed to serve once again, and at such an important time,” Gates said. “My parting advice for Leon is to get his office just the way he likes it -- he may be here longer than he thinks.”