On his first working day in charge of the Pentagon, Pat Shanahan got a taste of President Donald Trump's scattershot way of looking at the world.

As Shanahan sat to Trump's left at a Cabinet meeting at the White House, the president denounced U.S. allies as freeloaders, expressed disgust with U.S. warfighting strategy in Afghanistan, mused about his own potential to be a great general, dismissed Syria as "sand and death," spoke encouragingly of a second North Korea summit, and falsely claimed he had fired former Defense Secretary Jim Mattis.

It was a very public reminder of the challenges that Shanahan, as acting defense secretary, faces as he navigates the complex terrain that led to the early end of his predecessor's tenure.

At one point, Trump turned to Shanahan with an unusual demand.

The commander in chief said audits of Pentagon war spending must be "private" — an apparent reference to reports produced by the Special Inspector General for Afghanistan Reconstruction. Trump asserted that the reports give away too much information and should not be publicly released, although the law that created that watchdog's office says its reports must be made public.

Trump wished Mattis well in the retired Marine general's return to private life after two tumultuous years leading the Pentagon. But Trump also took a swipe at the man he had approvingly called "Mad Dog Mattis" when he hired him shortly after winning election in 2016.

"What's he done for me?" Trump asked. "How has he done in Afghanistan? Not too good."

He added, "President Obama fired him, and essentially so did I."

Trump did not explain his complaint about Mattis' approach to the war. But Trump hinted that he had irreconcilable differences with Mattis on what Trump views as an unfair defense relationship with allies such as NATO. Trump suggested that Shanahan, who took over as acting defense secretary when Mattis ended his tenure Monday, agrees with him on this.

"We have some great allies, but a lot of our allies were taking advantage of our taxpayers and our country," Trump said. "We can't let that happen, and Pat Shanahan agrees with that and he's agreed with that for a long time. And that was very important to me.

"I couldn't get other people to understand it," Trump said, apparently referring to Mattis, who argued for higher defense spending by NATO allies but did so in a nonconfrontational way.

In a resignation letter that amounted to a rebuke of Trump's view on how to treat alliances and adversaries, Mattis wrote, "My views on treating allies with respect and also being clear-eyed about both malign actors and strategic competitors are strongly held and informed by over four decades of immersion in these issues."

Mattis submitted his resignation on Dec. 20 after a series of policy disagreements with Trump, including the president's decision to withdraw troops from Syria. Mattis said he would stay until the end of February, but on Dec. 23 Trump announced that Shanahan would take over Jan. 1, speeding up Mattis' departure.

In his Cabinet meeting remarks with reporters present, Trump said he was in no rush to get U.S. troops out of Syria but did not clarify a timetable. Mattis and other Trump advisers tried unsuccessfully to persuade Trump to stay in Syria long enough to ensure that the Islamic State group, which has largely been defeated on the battlefield, cannot regroup. Nor did the president clarify plans in Afghanistan, where he has ordered a troop reduction on an unspecified timetable.

Shanahan, who had served as deputy to Mattis since July 2017, is a career business executive with no prior government or military experience. His views on alliance relations and other key defense issues are not well known. As the deputy secretary he had focused the budget as well as a Trump favorite topic: development of a Space Force.

At a morning meeting at the Pentagon with the military service secretaries and other top civilian officials, Shanahan said he was focused on the defense strategy developed during Mattis' tenure. It emphasizes the importance of great power competition with Russia and China, after America's many years of fighting insurgent wars in the Middle East.

In that context, Shanahan said the Pentagon leaders should remember, "China, China, China," according to one official, who was not authorized to publicly discuss internal defense meetings and spoke on condition of anonymity.

The Trump administration has had a rocky relationship with China. Like the Obama administration, Trump's government is concerned by what it calls China's militarization of disputed areas in the South China Sea and by its advances in certain high-tech weaponry.

Separately, Shanahan's spokesman, Lt. Col. Joe Buccino, said that as part of Shanahan's ethics agreement he had stepped aside himself "for the duration of his service" at the Pentagon from "matters in which the Boeing Company is a party." Shanahan had worked for Boeing for 31 years, including in positions overseeing big defense programs. It's unclear whether Trump will nominate Shanahan for Senate confirmation as defense secretary or turn to another candidate.

With Shanahan moving up from deputy secretary to acting secretary, the Pentagon's budget chief, David Norquist, has been chosen to fill in temporarily as the deputy secretary, according to Pentagon spokesman Tom Crosson.

Shanahan, a native of Washington state, holds a bachelor of science degree in mechanical engineering from the University of Washington and two advanced degrees from the Massachusetts Institute of Technology.