Sen. John McCain (R-Ariz.) gave a staunch defense of the free press Saturday, noting that attacks on the media are “how dictators get started.”

Speaking on NBC’s “Meet The Press,” to be aired Sunday, McCain took a swipe at President Donald Trump’s volleys against the Fourth Estate, particularly a Friday tweet in which the press was called the “enemy of the American people.”

“We need a free press,” said the 2008 Republican presidential candidate. “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,” he added.

McCain said that without a free press, “we would lose so much of our individual liberties over time.”

“That’s how dictators get started,” he added, noting that attacks on journalists questioning those in power are a tactic used by autocratic governments.

“When you look at history, the first thing that dictators do is shut down the press,” he said. “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.”

“A fundamental part of that new world order was a free press,” he added. “I hate the press; I hate you especially,” McCain quipped. “But the fact is we need you.”

Trump has ratcheted up his assaults against media organizations in recent weeks, culminating in a belligerent press conference Thursday in which he excoriated the members of the press as “fake news.”

McCain, in Germany for the Munich Security conference, has unleashed a series of thinly veiled attacks on the White House.

In a speech before the conference, he slammed a “hardening resentment” toward “immigrants, and refugees, and minority groups, especially Muslims” and asked world leaders not to give up on America despite the country’s current politics.

During a question-and-answer, the senator said the resignation of Michael Flynn, Trump’s former national security adviser, showed the administration was “in disarray.”