“He has been very consistent essentially since the 1980s,” said Eric S. Edelman, a former under secretary of defense for policy in the George W. Bush administration. “He knows very little about the world, about history, about the policy details. But he does have strong convictions and they are remarkably durable and apparently impervious to contrary evidence.”

They include, Mr. Edelman said, the belief that his predecessors were gullible, and that he will do better; that allies have exploited the United States, and must pay back their debts; that free trade is bad; and that military force should be used sparingly, but that “we should be strong and scary and that will make people afraid to screw with us.”

All those convictions were on vivid display in the East Room on Tuesday.

Mr. Trump reiterated his contention that the North American Free Trade Agreement is “a phenomenal deal for Mexico” and a “horrible deal for the United States.” Mexico, he complained, ran a trade surplus of more than $100 billion with the United States.

He claimed that no one had been tougher on Russia than him, pointing to his recently passed $700 billion defense budget. But Mr. Trump said nothing about his administration’s expulsion of 60 Russian diplomats as a punishment for the country’s role in a nerve agent attack on a former Russian spy and his daughter living in Britain.

“I could have a very good relationship with Russia,” he insisted. “And with President Putin. And if I did, that would be a great thing.”

Mr. Trump praised his three Baltic guests and promised that the United States would be a steadfast ally. But he slammed other NATO members for not paying their fair share of the alliance’s costs.

Nor did Mr. Trump spare a more favored ally, Saudi Arabia, which he said was pressing the United States to stay militarily engaged in Syria. The White House said the president spoke on Monday with King Salman of Saudi Arabia, and Mr. Trump seemed to refer to the conversation at the news conference. “I said, ‘Well, you know, you want us to stay, maybe you’re going to have to pay,’” he recalled.