Updated at 10:45 p.m. ET
Defense Secretary Jim Mattis, a living Marine Corps legend who made history by securing special permission from Congress to lead the Pentagon, is stepping down after a slow freeze-out by President Trump.
Drift between the two men reached a point at which Mattis objected so strongly to the president's policy choices that he opted to resign rather than go along.
The final break appeared to be over major withdrawals of American forces from Syria and Afghanistan, which Trump ordered over the objections of his national security advisers, including Mattis.
The president announced via Twitter Thursday evening that Mattis was retiring in February. Shortly after, the Pentagon released a letter of resignation from Mattis to Trump.
"General Jim Mattis will be retiring, with distinction, at the end of February, after having served my Administration as Secretary of Defense for the past two years," Trump wrote.
"General Mattis was a great help to me in getting allies and other countries to pay their share of military obligations. A new Secretary of Defense will be named shortly. I greatly thank Jim for his service!" the president also wrote in a second tweet about the impending departure.
Mattis' resignation completes a near-wholesale shake-up of Trump's initial national security team and follows a record-setting series of departures of administration leaders so early in a presidency.
Of Trump's initial top national security or diplomatic policy advisers, only Secretary of State Mike Pompeo, who began as CIA director, and United Nations Ambassador Nikki Haley remain — and Haley is set to depart the administration soon as well.
The resignation followed an abrupt decision by Trump this week to withdraw American troops from Syria, over the objections of many of the president's military and national security advisers.
The news about Mattis was followed by confirmation that Trump is also ordering home roughly half the troops posted in Afghanistan.
Mattis wrote in a resignation letter that he felt he could no longer continue to execute Trump's policies. He cited the importance of what he called America's "unique and comprehensive system of alliances and partnerships."
The outgoing defense secretary cited two such alliances by name: NATO, which has been supporting the war in Afghanistan since not long after the 2001 terrorist attacks against the United States; and the coalition of nations that has united to fight the Islamic State.
Trump's forthcoming military withdrawals from Afghanistan and Syria would drastically reshape the role the United States plays not only in those ongoing conflicts but in the coalitions that are engaged with them.
Wrote Mattis: "Because you have the right to have a secretary of defense whose views are better aligned with yours ... I believe it is right for me to step down from my position."
In a statement issued late Thursday, Senate Majority Leader Mitch McConnell, R-Ky., echoed concern about the alliances the U.S. is a part of in military hot spots across the globe:
"I believe it's essential that the United States maintain and strengthen the post-World War II alliances that have been carefully built by leaders in both parties. We must also maintain a clear-eyed understanding of our friends and foes, and recognize that nations like Russia are among the latter.
"So I was sorry to learn that Secretary Mattis, who shares those clear principles, will soon depart the administration. But I am particularly distressed that he is resigning due to sharp differences with the president on these and other key aspects of America's global leadership."
McConnell added that he urged Trump to select a new defense secretary "who shares Secretary Mattis's understanding of these vital principles and his total commitment to America's service members." The Senate must confirm Trump's nominee to replace Mattis atop the Department of Defense.
Departure of a major figure
Mattis' departure is significant. He enjoyed outsize influence with Trump from his first day back in government and was, for example, credited with single-handedly changing Trump's mind on the use of harsh interrogation with terrorism suspects.
Trump campaigned in 2016 on the need to revive brutal techniques such as waterboarding and "a lot worse," but he ceded that policy to Mattis after a conversation in which the former Marine general told him he could get better results by offering sympathy in interrogations.
"'I've always found, give me a pack of cigarettes and a couple of beers and I do better with that than I do with torture,'" as Trump described the conversation.
So Trump backed away from his stance on torture and continued to lean on Mattis for advice about the toughest national security challenges in the early phase of his presidency.
Trump relied on Mattis to execute his orders for two missile attacks on Syria in April in retaliation for the use of chemical weapons, and Mattis also played the good cop after Trump's bad cop in dealing with allies in Europe and Asia.
Mattis' long-standing enmity toward Iran also established a strong trend line in policy for Trump, although Mattis stopped short of telling members of Congress that the Iran nuclear deal wasn't working. It was working, he said — although Trump decided in May to abrogate America's participation in it.
But Trump also grew frustrated with Mattis and the rest of his advisers — including then-National Security Adviser H.R. McMaster and then-Secretary of State Rex Tillerson — over the sputtering war in Afghanistan.
Trump, who had at one time harbored ideas of simply cutting bait on Afghanistan and withdrawing nearly all American troops, found that Mattis and his military advisers counseled doubling down with increased deployments, again.
The frustration appeared to go both ways. Mattis and Joint Chiefs Chairman Gen. Joe Dunford were blindsided by Trump's spur-of-the-moment announcement last summer that the military would ban transgender troops, a policy they opposed.
President comes into his own
Trump grew more confident in his role over time. As the only president with no experience in elective office or the military, Trump had relied on Mattis and other advisers of his vintage for on-the-job orientation about America's global security posture and what was considered feasible and not feasible in various regions around the globe.
With more time in the job, Trump felt more comfortable going his own way, meaning the role that Mattis played as a mentor-adviser was diminished.
Trump was said to have smarted at the notion that there was a "Committee to Save America," comprising Mattis, Tillerson and others, which was fencing a feckless Trump safely away from serious mistakes.
The "committee," if there ever really was one, now is mostly gone — McMaster, Tillerson, former chief economic adviser Gary Cohn and several others all have left the administration.
According to reports, Mattis was cut out of Trump's decision on the Iran deal and also was not aware that Trump planned to commit to freezing U.S. and South Korean military exercises as part of nuclear negotiations with North Korea.
The overall impression was that Trump, at some point along the line, stopped listening to Mattis in the way he once had.
Myth of "Mad Dog"
Mattis is a three-war veteran with service in Afghanistan and two Iraq wars, first in the 1991 Desert Storm campaign and then again following the 2003 invasion. The Marine Corps ground commander was revered perhaps more than any of his contemporaries — he is the subject of memes, quote pages and other devotional treatments.
But when he rose to become head of U.S. Central Command, the military combatant command responsible for the Middle East, he fell out with President Barack Obama's administration, likely over Iran policy.
Mattis retired and said at the time he did not expect to return to public service. U.S. law barred former commanders of his stature from serving as secretaries of defense until after a cooling-off period, a practice designed to preserve civilian control of the military.
But Mattis came to the attention of Trump after his election, in part because of a nickname he'd picked up in Iraq: "Mad Dog." Mattis didn't like the nickname and it was mostly the province of newspaper headlines, but the impression, for Trump, was made.
President-elect Trump, as he then was, invited Mattis to join him onstage at a rally in December 2016. Trump later sought, and received, a waiver from Congress that permitted Mattis to take over the Defense Department, even though he was still technically within the window barring him from a civilian leadership position.
If Trump thought "Mad Dog" Mattis was going to take after his moniker, however, he did not know his man. The cerebral, often soft-spoken Mattis told reporters he preferred the nickname "Jim." He told Congress that his study of history meant he was seldom surprised by world events.
All along, however, Mattis was aware of his reputation as a "warrior monk" and, to the degree that he could in the shadow of a headline-jealous Trump, continued cultivating it.
John Dickerson of CBS News, for example, asked Mattis in an interview what scared him or kept him up at night.
"Nothing," he responded. "I keep other people up at night."