Chuck Hagel left his job as the US defence secretary after less than two years.
President Obama said that he was leaving office and praised his “class and integrity.”
Mr. Hagel, who was a Republican senator and served in the Vietnam War, said it was the “greatest honour” of his life.
Last month, it was said that he was very critical of how the US was dealing with Islamic State and the Syrian government.
He will keep working as a secretary until a new one is chosen.
An official who didn’t want to be named told the Associated Press that Hagel and Obama both agreed “it was time for new leadership at the Pentagon” and had been talking about the move for weeks.
Obama said that Hagel had come to see him to talk about “the right time to end his service.”
The US president said he was “extraordinarily lucky” to have Mr. Hagel as his defence secretary and praised him for building strong relationships with US troops.
Mr. Hagel is the first enlisted veteran of combat to hold this job.
In a short statement, Mr. Hagel said, “It has been the greatest honour of my life to lead the men and women of the Defense Department and, most importantly, to serve them.”