President Trump speaks at the Economic Club of New York on November 12, 2019.

President Donald Trump on Tuesday said that he has no problem meeting with dictators as long as it's "good for the United States."

"When I meet with the leaders of countries as they come in — kings and queens and prime ministers and presidents and dictators — I meet 'em all," Trump said during a lengthy speech at the Economic Club of New York.

"Anybody wants to come in. Dictators? It's OK. Come on in. Whatever's good for the United States. We want to help our people," Trump said.

"But the first thing they say to me, almost always: 'Congratulations on your economy,'" Trump claimed.

The comment appeared to upend decades of American foreign policy, which has been predicated on wielding America's outsized global influence as a force for elevating democratic governments that respect human rights and marginalizing dictators and autocrats.

Those remarks appeared to diverge from the president's written speech, which credited the Trump administration's policies for the strength of the U.S. economy. Excerpts released by the White House ahead of the speech highlighted the number of jobs added and the rise in wages during Trump's presidency.

The White House did not clarify to CNBC whether Trump's comments about dictators were included in his complete prepared text.