President Donald Trump tweeted on Thursday that Defense Secretary Jim Mattis, a retired Marine general who was one of Trump’s first Cabinet picks, would be retiring at the end of February.

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. During Jim’s tenure, tremendous progress has been made, especially with respect to the purchase of new fighting.... — Donald J. Trump (@realDonaldTrump) December 20, 2018

....equipment. 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! — Donald J. Trump (@realDonaldTrump) December 20, 2018

Mattis, who served more than four decades in the military and headed the U.S. Central Command from 2010 to 2013, won Senate confirmation as defense secretary on Jan. 20, 2017, shortly after Trump’s inauguration.

The Pentagon chief, nicknamed “Mad Dog Mattis” during his time as a Marine, echoed Trump’s call for strengthening the military and beefing up its combat readiness. The budget bill the president signed into law in February earmarked $700 billion for the Defense Department this fiscal year ― a more than 15 percent increase over the previous year and the biggest hike in military spending since 2002.

Mattis’ resignation letter addressed to Trump indicates his final day in office will be Feb. 28.

“I am proud of the progress that has been made over the past two years on some of the key goals articulated in our National Defense Strategy: putting the Department on a more sound budgetary footing, improving readiness and lethality in our forces, and reforming the Department’s business practices for greater performance, he wrote.

“Our troops continue to provide the capabilities needed to prevail in conflict and sustain strong U.S. global influence.”

Defense Secretary James Mattis has resigned. Here’s the letter: pic.twitter.com/e2PulyXpXZ — Elizabeth McLaughlin (@Elizabeth_McLau) December 20, 2018

In the unusual letter, Mattis also wrote that he and Trump had differing views on Russian and Chinese authoritarianism: “Because you have the right to have a Secretary of Defense whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down from my position.”

Earlier this week, Trump went against Mattis by abruptly withdrawing U.S. troops from Syria. Mattis had previously argued that a small U.S. presence should remain because the counterterrorism mission there is ongoing and removing troops now would cause more problems for the region. Additionally, forces were withdrawn despite the concern by many Republicans that “leaving would strengthen the hand of Russia and Iran, which both support Syrian President Bashar al Assad.”

SIPA USA/PA Images Defence Secretary Jim Mattis has denied telling staffers that Trump has the understanding of a “fifth- or sixth-grader.”

News of Mattis’ departure comes in the wake of reports that the White House had been discussing who might replace him, a topic that was first reported by The Washington Post in early September.

Some of the top names that were reportedly under consideration included four-star Army Gen. Jack Keane, Sen. Tom Cotton (R-Ark.), Sen. Lindsey Graham (R-S.C.), former Treasury Department official David McCormick and former Republican Sen. Jim Talent of Missouri.

Trump denied that he had been looking to replace Mattis, telling reporters that he was “very happy” with him.

That assurance came ahead of the release of a book by acclaimed Watergate journalist Bob Woodward, which reported that Mattis once told staffers that Trump has the understanding of a “fifth- or sixth-grader.” Mattis has denied having said that.

A major split between Trump and Mattis concerned Russian President Vladimir Putin. The defense secretary has characterized Putin as trying to undermine NATO and assaulting Western democracies while violating international norms.

“[Putin’s] actions are designed not to challenge our arms at this point, but to undercut and compromise our belief in our ideals,” Mattis told U.S. Naval War College graduates at a commencement ceremony in June.

Trump, in contrast, has praised Putin’s leadership skills and recently roiled U.S. allies by calling for Russia’s reinstatement to the Group of Seven major industrial nations. Russia was expelled from what was then the Group of Eight after its annexation of Crimea from Ukraine.

Jonathan Ernst/Reuters Mattis became the latest high-profile appointee to leave the Trump administration.

Mattis had also argued that the U.S. should consider staying in the Iran nuclear deal unless Tehran was found not to be abiding by the multi-nation agreement. Iran was following the pact’s rules, according to the International Atomic Energy Agency, which monitors the use of nuclear energy and has verified Iranian compliance with the accord multiple times since 2015.

Trump went on to pull out of the deal in May, claiming that it had been poorly negotiated during the Obama administration.

Mattis opposed Trump’s proposed ban on transgender service members, as well as the use of torture in the interrogation of terrorist suspects.

His most prominent moment in the public spotlight occurred in April when he handled briefings on Trump’s decision to conduct targeted airstrikes against Syria in response to the alleged use of chemical weapons by Assad’s regime in that nation’s civil war.

Even then, Mattis’ recommendation that congressional approval be sought for the strikes put him at odds with the president. Trump overruled the defense secretary and unilaterally ordered the military assault.

Mattis joins a growing list of high-profile departures from the administration. Trump fired Secretary of State Rex Tillerson earlier this year, and Tom Price stepped aside as secretary of health and human services last fall amid ethical questions about his travel practices.

Reince Priebus lasted barely six months as White House chief of staff, and Sean Spicer had a similarly short tenure as press secretary.

White House Communications Director Hope Hicks, a Trump aide before he won the presidency, announced her resignation in February.

White House deputy chief of staff Joe Hagin, who also served in the Ronald Reagan, George H.W. Bush and George W. Bush administrations, is expected to leave his post in July, Politico reported.

CORRECTION: A previous version of this article said that Sen. Tom Cotton represents Alabama. He is from Arkansas.