After Barack Obama assumed the presidency in 2009, he chose to keep Gates in office, making him the only defence secretary in US history to survive a partisan change at the White House.

Early years

Gates was recruited by the CIA in 1966, while pursuing a master's degree in history from Indiana University.

He served briefly in the Air Force's Strategic Air Command, delivering intelligence briefings to ballistic missile crews, before returning to the CIA, where he would spend the majority of the next 14 years.

Gates served as a staff member on president Gerald Ford's National Security Council from 1974 to 1979. 

In the 1980s, Gates ascended the ranks of the CIA.

He was named deputy director for intelligence in 1982 and deputy director for the entire agency in 1986.

Stains of Iran-Contra

First nominated as CIA director in 1987 by President Ronald Reagan, Gates withdrew amid questions over his and the CIA's role in the secret sales of arms to Iran and the diversion of profits to Nicaragua's Contra rebels.

Later, during hearings in 1991, Gates admitted mistakes and said he should have done more to get at the truth.

From 1989 to 1991, Gates left the CIA to serve as deputy national security adviser to President George Bush (Senior).

In May 1991, Bush nominated Gates again to be CIA director, and Gates was confirmed by the Senate in November.

His career at the top would be short, however. Less than two years later, in August 1993, the final report of the independent counsel investigating the Iran-Contra affair found that Gates was close to many of the figures involved in the scandal and in a position to know about their activities.

He resigned that year.

Called back to service
  
After leaving the CIA, Gates spent years lecturing at various US universities before joining Texas A & M University in College Station, Texas.

He also became a member of the bipartisan Iraq Study Group, headed by Republican former secretary of state James Baker and Democratic former congressman Lee Hamilton, which was charged with making policy recommendations to the government about the Iraq war.

In 2005, he turned down an offer from President Bush to become the director of national intelligence.

But the call to service would prove too strong the following year, when Donald Rumsfeld, resigned.

Bush nominated Gates, who was confirmed by the Senate in a 95-2 vote in December 2006.