Republican Sen. John McCain took a veiled swipe at President Donald Trump's attacks on the media, cautioning that suppressing the press “is how dictators get started.”

McCain, who has broken with Trump on several issues, made the comments in an exclusive interview with NBC’s "Meet the Press" host Chuck Todd, after being asked about the president’s condemnation of several media outlets as "fake news" and "an enemy of the American people."

"I hate the press. I hate you especially," McCain joked. "But the fact is we need you. We need a free press. We must have it. It's vital."

"If you want to preserve — I'm very serious now — if you want to preserve democracy as we know it, you have to have a free and many times adversarial press," McCain said. "And without it, I am afraid that we would lose so much of our individual liberties over time. That's how dictators get started."

The Arizona Republican cautioned that he was not accusing Trump of trying to be a dictator. He made the comments during a discussion of the post-World War II world and America’s role in it.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"They get started by suppressing free press," McCain said of dictators. "In other words, a consolidation of power when you look at history, the first thing that dictators do is shut down the press. And I'm not saying that President Trump is trying to be a dictator. I'm just saying we need to learn the lessons of history."

McCain was also asked about calls in Congress for investigations into Russia’s alleged role in a campaign to interfere in the 2016 presidential election, andwhat contacts former Trump’s national security adviser Michael Flynn had with Russia’s ambassador to the United States prior to the inauguration. Flynn resigned Monday.

"Can be Americans be confident that a Republican-controlled Congress can investigate this president thoroughly if necessary?" Todd asked.

McCain replied: "I hope so. And I have to believe so." McCain then added, "More hope than belief."

McCain at the Munich Security Conference on Friday warned a “of an increasing turn away from universal values and toward old ties of blood, and race, and sectarianism,” in the West, as well “the growing inability and even unwillingness to separate truth from lies."

McCain said European leaders he’s spoken with have been reassured by speeches by Defense Secretary James Mattis and Department of Homeland Security Secretary John Kelly.

"They have a lot of trust in these individuals," McCain said. "We've just got to have a consistent message to these people who are seriously threatened, particularly our friends in the Baltics."

Related: Pence Tells Europe: US Backs NATO, Will Put ISIS on 'Ash-Heap'

McCain repeated his confidence in Trump’s national security team. When asked how much confidence he has in Trump as commander-in-chief, McCain expressed some doubts — pointing to the chaotic implementation of Trump's travel restrictions on those from seven predominantly Muslim nations.

"I worry about the president's understanding of some of these issues and his contradictory articulations. And I think the rollout of the, quote, immigration reform was an example of a need for an orderly decision-making process in the White House," McCain said.

McCain said he was troubled by Trump’s response to a recent challenge in a Fox News interview that Russian President Vladimir Putin is "a killer" — in which Trump said "What, do you think our country's so innocent?"

"I guess it was Bill O'Reilly who said, ‘But Putin is a killer.’ And he basically said, 'So are we,'" McCain said. "That moral equivalency is a contradiction of everything the United States has ever stood for in the 20th and 21st century."

McCain added later about his confidence in Trump as commander in chief: "I think we should give the president the benefit of the doubt. But at the same time, we have our responsibilities of advise and consent."