The White House barred several media outlets from covering a briefing with spokesman Sean Spicer on Friday afternoon — a dramatic escalation in its war on the press.

The press secretary decided to hold the off-camera meeting with the press inside his West Wing office instead of the traditional briefing in the James S. Brady Press Briefing Room.

Among the slew of outlets barred from the invitation-only gaggle were news organizations that President Trump has singled out for criticism, including CNN and the New York Times.

The Hill, Politico, BuzzFeed, the Daily Mail, the BBC, the LA Times and the New York Daily News also were kept away.

Time magazine and the Associated Press stayed away in a show of solidarity.

The major networks — Fox, CBS, ABC and NBC — were invited, as were several outlets that cater to a conservative audience, such as Breitbart, the Washington Times and One America News Network.

The White House invited the regular media “pool” — which on Friday consisted of Hearst Newspapers and CBS — as well as the other outlets into Spicer’s office, while barring the rest.

In the past, White House press secretaries would sometimes hold gaggles with similar “expanded pools” — but the selective invitation to conservative outlets, including those friendly to the Trump administration, is unprecedented, Politico reported.

The White House Correspondents’ Association assailed the breach of media coverage protocol.

“The WHCA board is protesting strongly against how today’s gaggle is being handled by the White House,” Jeff Mason, the association’s president, said in a statement.

“We encourage the organizations that were allowed in to share the material with others in the press corps who were not,” he added. “The board will be discussing this further with White House staff.”

New York Times Executive Editor Dean Baquet also slammed the White House.

“Nothing like this has ever happened at the White House in our long history of covering multiple administrations of different parties,” he said.

“We strongly protest the exclusion of The New York Times and the other news organizations. Free media access to a transparent government is obviously of crucial national interest.”

Ari Fleischer, White House press secretary under President George W. Bush, weighed in by saying press secretaries should deal with all outlets.

“Calm down everyone. Press secs SHOULD brief/gaggle w all press. But WH staffs & POTUSes often meet w who they want,” he tweeted.

A White House spokesman did not respond to a request for comment.

Spicer’s action came after Trump devoted 12 minutes of a 48-minute speech at the Conservative Political Action Conference to assailing the press.

“I’m not against the media. I’m not against the press … I am only against the fake news media or press,” he said.

Trump also praised the LA Times — one of the outlets banned from the “gaggle” — for doing “a great job” for correctly forecasting his election victory when most polls showed Hillary Clinton winning.