In a tweet on Thursday evening, President Donald Trump announced that Defense Secretary Jim Mattis would be leaving the Pentagon in February 2019. In his resignation letter, Mattis said the president needed someone more aligned with his views.

WASHINGTON — Defense Secretary Jim Mattis on Thursday announced he will step down from that post by the end of the February, leaving a significant leadership void in President Donald Trump’s Cabinet.

In his resignation letter Thursday, Mattis told Trump he was making the move to allow the president to find “a secretary of defense whose views are better aligned with yours.”

Mattis, a former Marine Corps general, is regarded highly among defense experts and is a well-respected military mind among lawmakers. On numerous occasions over the last two years, both Republicans and Democrats have lauded him as a calming presence within the turbulent Trump administration and a voice of reason for the sometimes impulsive commander in chief.

He’s also wildly popular among troops. A Military Times poll conducted in late September found that nearly 84 percent of troops had a favorable view of his work leading the armed forces. Among officers, the figure was almost 90 percent.

But Mattis’ relationship with Trump had appeared to sour in recent months as the president pushed for more aggressive military policies.

Read Mattis' full letter here.

Pentagon officials appeared caught unaware by sudden decisions made in the Oval Office on forming a new Space Force, sending troops to the southern U.S. border, and banning transgender recruits from the ranks. This week, Mattis and other top defense officials appeared to be surprised by Trump’s plans for a rapid withdrawal of U.S. forces from Syria.

On Twitter Thursday, Trump hailed Mattis for “tremendous progress” on helping to rebuild the military, including “the purchase of new fighting equipment” and “getting allies and other countries to pay their share of military obligations.”

He said a new secretary of defense would be announced in coming days. Expect the names of Sen. Tom Cotton, R-Ark., and Jack Keane, a retired Army general who was an early supporter for Trump, to pop up in discussions.

In his resignation letter, Mattis said he was “proud of the progress that has been made over the past two years in … putting the department on more sound budgetary footing, improving readiness and lethality in our forces, and reforming the department’s business practices.”

But he also took aim at several Trump policies that caused friction between the White House and the Pentagon.

Defense Secretary Jim Mattis, from left, with President Donald Trump, Chairman of the Joint Chiefs of Staff Gen. Joseph Dunford and Marine Corps Commandant Gen. Robert Neller, speaks during a briefing with senior military leaders in the White House on Oct. 23, 2018. (Manuel Balce Ceneta/AP)
Defense Secretary Jim Mattis, from left, with President Donald Trump, Chairman of the Joint Chiefs of Staff Gen. Joseph Dunford and Marine Corps Commandant Gen. Robert Neller, speaks during a briefing with senior military leaders in the White House on Oct. 23, 2018. (Manuel Balce Ceneta/AP)

In the letter, Mattis wrote that he believes America “must be resolute and unambiguous in our approach to those countries whose strategic interests are increasingly in tension with ours.”

That includes “treating allies with respect” and doing “everything possible to advance an international order that is most conducive to our security, prosperity and values.”

He also specifically mentioned both the defeat-ISIS coalition of 74 nations and NATO as “proof” alliances that have benefited America,

The timing of the resignation — just a day after Trump ordered the withdrawal of U.S. forces from Syria, reportedly over the objections of Mattis — is noteworthy, especially given Mattis' reference to the ISIS coalition in his letter.

Appearing on CNN shortly after the announcement, Trump’s senior adviser Stephen Miller did nothing to quell the idea that Mattis quit over the Syria decision, saying it is time for Trump “to get a new secretary of defense who will be aligned with the president” on a variety of issues, specifically calling out Syria and burden sharing among NATO allies.

Miller also reiterated Trump’s statements that it is time for Syria and Russia to take over the fight against ISIS, while railing against the decision of America to stay in Afghanistan and Iraq. When asked by CNN’s Wolf Blitzer if the administration intended to leave those countries as well, Miller said “I have absolutely no policy announcements of any kind to make tonight, whatsoever.”

For months, speculation has swirled around whether Mattis could survive into year three of the administration, particularly after Trump labeled him as “sort of a Democrat” during an interview in October.

However, he appeared to solidify his position within the administration in the days leading up to the mid-term elections, with a full-throated support for the president’s decision to send troops to the border.

Mattis said the February leave date is designed to ensure a new defense secretary is in place well before September’s changeover of the chairman of the joint chief of staff. Just two weeks ago, Trump announced that Gen. Mark Milley, the current army chief of staff, would be his nominee to replace current chairman Gen. Joe Dunford.

The announcement, coming almost 10 months before Dunford’s term was over, caught many by surprise, and now sets up the military for a wholesale leadership change in 2019.

It also represented another pressure point between Trump and the secretary. Both Mattis and Dunford supported the candidacy of Gen. David Goldfein, the Air Force’s top officer, but Trump picked Milley instead.

Along with Dunford, all of the joint chiefs are in line to turn over in 2019, meaning a new secretary will also have a new group of the highest uniformed officials to work with.