WASHINGTON — On his final day as secretary of defense, Jim Mattis on Monday urged all Pentagon employees, military and civilian, to “hold fast” in defense of the country.

Mattis, who submitted his resignation on Dec. 20 and was in effect fired by President Trump three days later, was working in the Pentagon on Monday and preparing to hand off his duties at midnight to Deputy Secretary Patrick Shanahan.

Trump picked Shanahan, a former Boeing Co. executive with no previous government or military experience, to serve as acting defense secretary, pending a decision on who would be nominated to serve in a more permanent capacity.

In a written farewell message, Mattis quoted a one-sentence telegram that President Abraham Lincoln sent to the commander of Union forces, Gen. Ulysses S. Grant, on Feb. 1, 1865, in the final weeks of the Civil War.

It said: “Let nothing which is transpiring, change, hinder, or delay your military movements, or plans.”

Mattis, who resigned over a series of policy disagreements with Trump, including the president’s decision to withdraw U.S. troops from Syria, said he’s confident Pentagon employees will remain “undistracted from our sworn 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,” he wrote. “So keep the faith in our country and hold fast, alongside our allies, aligned against our foes.”

Mattis is the first retired military general to serve as defense secretary since George Marshall in the early 1950s.