US Defence Secretary Jim Mattis will be retiring “with distinction” at the end of February, President Donald Trump announced on Thursday.
Mr Trump tweeted that General Mattis “was a great help to me in getting allies and other countries to pay their share of military obligations”.
It comes a day after the president’s controversial announcement that all US troops would be withdrawn from Syria.
Mr Trump did not name a successor, but said one would be appointed shortly.
In his resignation letter, Gen Mattis described his views on “treating allies with respect” and using “all the tools of American power to provide for the common defence”.
“Because you have the right to have a secretary of defence whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down,” Gen Mattis wrote.
- White House revolving door: Who’s gone?
- Trump rewrites US Syria policy
Responding to the news, Republican Senator Lindsey Graham said Gen Mattis “should be proud of the service he has rendered to President [Trump] and our nation”.
“He has been in the fight against radical Islam for decades and provided sound and ethical military advice to President Trump,” he tweeted.
Democratic Senator Mark Warner said the development was “scary”, describing Gen Mattis as “an island of stability amidst the chaos of the Trump administration”.
A protest resignation, plain and simple
Analysis by Anthony Zurcher in Washington
Donald Trump may try to spin James Mattis’ departure as a retirement after a lifetime of government service. It’s not. This is a protest resignation, plain and simple.
The defence secretary’s letter to the president – in which he offers full-throated support for a US network of alliances and calls for a policy of containment of authoritarian rivals – makes that perfectly clear.
The timing of this announcement, just a day after Mr Trump abruptly ordered the withdrawal of US troops from Syria and amid rumours of an Afghanistan pullout, should also dispel any doubt about stark policy differences between the two men.
Gen Mattis had positioned himself as one of the cooler heads throughout the president’s term – considered by Democrats and Republicans alike as a “grown-up” in the room and a far cry from the “Mad Dog Mattis” nickname that so enamoured Mr Trump.
From his Pentagon office across the Potomac River from the White House, he managed to stay largely above the fray, frequently assuaging the concerns of US allies unnerved by some of the president’s more intemperate statements.
Now that check on the president, one of the last few remaining, is heading out, suggesting turbulent waters ahead.
What did Trump say about Syria?
Mr Trump announced his decision to withdraw some 2,000 US troops from Syria on Wednesday, asserting that the Islamic State (IS) group had been defeated there.
The news, which was met with strong criticism, is at odds with Mr Mattis’ position, who had warned that an early withdrawal from the country would be a “strategic blunder”.
US troops have helped rid much of Syria’s north-east of the jihadist group, but pockets of fighters remain.
The Pentagon said it was transitioning to the “next phase of the campaign” to eliminate IS but did not provide further details.
President Trump, who has long pledged to pull troops out of Syria, said on Twitter that it was time to bring them home after their “historic victories”.
In a later tweet, he defended his decision and said it should not have come as a surprise.
US officials quoted by Reuters news agency say that in addition, air attacks against IS will cease.
The White House would not give a timescale for the withdrawal but defence officials quoted by the New York Times said President Trump wanted it done within 30 days.
What has the reaction been?
Mr Graham, who is one of Mr Trump’s supporters and sits on the armed services committee, called the withdrawal decision a “huge Obama-like mistake”, which would have “devastating consequences” both in Syria and beyond.
He said he feared it would mean ceding influence in the region to Russia and Iran.
Another Republican senator, Bob Corker, who is chair of the foreign relations committee, went further, saying it was “much worse” than Barack Obama’s decision to pull US troops out of Iraq when he did.
“This is a transactional, political decision. It is not a decision based on facts on the ground,” he told the BBC.
Meanwhile France, which has been a key part of the US-led coalition against IS in Syria and Iraq, said its troops would remain in northern Syria for now because IS had not been wiped out.
German Foreign Minister Heiko Maas said the US decision risked damaging the fight against IS.
The Syria Democratic Forces (SDF), a Kurdish-led alliance in Syria, warned that the withdrawal would “negatively impact” the anti-IS campaign and allow the group “to revive itself again”.