At a farewell ceremony on the Pentagon parade field Thursday, President Barack Obama honored outgoing Defense Secretary Robert Gates with the Presidential Medal of Freedom, the highest award the president can give a civilian.

Speaking in front of a number of active and retired military and civilian leaders, Obama turned to Gates and said, "this was not part of the program," before he announced the award.

Gates was noticeably surprised by the honor and when he stood to receive it he quipped, "We should all know by now you're getting pretty good at this covert ops stuff," -- a reference to the now infamous Bin Laden raid.

Obama recognized Gates for his unique service under two presidents, Democratic and Republican, while the nation was in the midst of two wars. He encouraged the rest of Washington to take note of the selfless manner in which Gates served, putting politics aside and his "nation first."

Obama thanked Gates for his 40 years in government and called him one the nation's finest public servants.

Among the many people Gates recognized for their contributions through his tenure, he saved the most important for last. He thanked his wife Becky for standing by his side since they met on a blind date 45 years ago in Bloomington, Indiana.

Secretary Gates and his wife will fly to their home in Washington state Thursday afternoon with a normal military escort and full communications. He will remain in the military's top civilian position until Leon Panetta is sworn in as the 23rd Secretary of Defense at 9:00 a.m. Friday in the Pentagon.

Gates has served in his role as secretary since December 18th, 2006 and will be the 4th longest serving defense secretary behind Robert McNamara, Caspar Weinberger and Donald H. Rumsfeld.