WASHINGTON (Reuters) - Defense Secretary Jim Mattis gave his farewell message to the U.S. armed forces on Monday, telling them to “keep the faith in our country” and stand firm alongside allies after he resigned over policy differences with President Donald Trump.

FILE PHOTO: U.S. Defense Secretary James Mattis waits to welcome Chinese Minister of National Defense Gen. Wei Fenghe to the Pentagon in Arlington, Virginia, U.S., November 9, 2018. REUTERS/Yuri Gripas/File Photo

Mattis, who had been seen as a stabilizing factor in U.S. defense policy, is due to transfer authority near midnight to his deputy, Patrick Shanahan, a former Boeing Co executive.

Mattis, a retired Marine general who has often shied from the spotlight, did not have any sort of departure ceremony when he left the Pentagon, leaving his farewell memo as his final public remarks as defense secretary. Historically, departing secretaries have had a major ceremony.

In his brief message, Mattis acknowledged the political turbulence in Washington but called on the U.S. military to stay firm in its mission “to support and defend the Constitution while protecting our way of life.”

“Our department is proven to be at its best when the times are most difficult. So keep the faith in our country and hold fast, alongside our allies, aligned against our foes,” Mattis said.

Last week Trump said he was replacing Mattis two months earlier than had been expected, a move officials said was driven by Trump’s anger at Mattis’ resignation letter and its rebuke of the president’s foreign policy.

Mattis had abruptly quit after falling out with Trump, including over surprise decisions to withdraw all troops from Syria and start planning a drawdown in Afghanistan.

Mattis’ resignation letter laid bare the growing divide between them, and implicitly criticized the president for failing to value America’s closest allies, who fought alongside the United States in both conflicts.

Shanahan, best known for his focus on internal Pentagon reform and his private-sector experience, will take over as acting defense secretary on Tuesday. Trump has suggested Shanahan could stay in the role as acting secretary for a considerable amount of time.

Shanahan has served as the deputy secretary of defense since July 2017. Before joining the Pentagon last year, he spent three decades at Boeing and was the general manager for the 787 Dreamliner passenger jet.

Shanahan is not expected to break from major Pentagon policies, including a new focus on the military threats from China and Russia, which were outlined in the U.S. National Defense Strategy.

"Mr. Shanahan was instrumental in crafting the National Defense Strategy. His ideas, priorities and philosophy are in that document," his spokesman, Army Lieutenant Colonel Joe Buccino, said. That document can be seen at bit.ly/2CbX9QM