President Trump cannot block people from his @realDonaldTrump account just because he doesn’t like their political views, a Manhattan federal judge ruled on Wednesday.

Doing so violates their First Amendment right to free speech because Twitter is a “public forum,” Judge Naomi Reice Buchwald wrote in a potentially precedent-setting ruling that could change how public officials use Twitter.

“We reject the defendants’ contentions that the First Amendment does not apply in this case and that the President’s personal First Amendment interests supersede those of plaintiffs,” the judge wrote in her 75-page ruling.

“No government official — including the President — is above the law, and all government officials are presumed to follow the law as has been declared,” the judge said.

Buchwald’s ruling came in response to a lawsuit by seven people — including a Texas cop and a NYC comic — who said they suffered “irreparable injury to their First Amendment rights” when Trump blocked them from expressing their views to him via Twitter.

The people who sued were blocked for tweets that made fun of the President or opposed his views, the suit said.

Brandon Neely, a police officer in Houston, Tex., says he was blocked on June 12, 2017 after Trump’s tweeted: “Congratulations! First new Coal Mine of Trump Era Opens in Pennsylvania.” Neely replied: “Congrats and now black lung won’t be covered under #TrumpCare.” He was blocked the following day.

Philip Cohen, a sociology professor at the University of Maryland, was blocked after he replied to @realDonaldTrump on June 6, 2017 with a tweet showing a photograph of the President with these words “Corrupt Incompetent Authoritarian. And then there are the policies. Resist,” superimposed over the President’s photo.

The tweet received 307 likes and 35 retweets. Roughly 15 minutes later, Cohen was blocked, the lawsuit claimed.

Ken Paulson, president of the Freedom Forum Institute’s First Amendment Center, said he was surprised by the ruling.

“The judge is taking a social media account launched well before Donald Trump was a public official and declaring it to be a public forum. That’s new legal turf,” said Paulson, who’s also dean of Middle Tennessee State University’s College of Media and Entertainment.

Trump has garnered over 52.2 million followers posting about everything from the NFL to North Korea to his disdain for Robert Mueller probe into Russia’s interference in the 2016 presidential election.

But if he is using his Twitter account for official business, that’s “government speech” and cannot be doled out to select people, said First Amendment lawyer Wayne Giampietro.

“I think this decision is correct,” Giampietro said. “You can’t block others just because you don’t like that they have to say.”

“The president’s practice of blocking critics on Twitter is pernicious and unconstitutional, and we hope this ruling will bring it to an end,” said Jameel Jaffer, executive director of the Knight First Amendment Institute at Columbia University, which brought the lawsuit.

The Justice Department, which argued Trump had every right to block whomever he wanted from his Twitter feed, declined to say whether it will appeal the ruling.

“We respectfully disagree with the court’s decision and are considering our next steps,” a spokesman said.

Giampietro thinks the “thorny” issue is how to proceed if Trump decides not to abide by the ruling.

“Could you hold the president in contempt? That’s the kind of thing that could go all the way up to the Supreme Court,” he said.

Media and entertainment lawyer Alan Neigher said he had “no doubt, whatsover” that the ruling would be upheld on appeal because Trump’s use of Twitter to make policy announcements “made it a public forum, and those who agree with him get access.”

“The books are full of officials trying to exclude people they don’t like from meetings or from getting documents,” he said.

“But almost never will a court allow a government official to exclude the press or the public because they don’t like the questions being asked.”

The ruling could also impact how public officials use social media platform in general, including Facebook and YouTube.

In fact, the Knight Institute is also representing Virginia resident Brian Davison in his lawsuit claiming that Phyllis Randall, the Chair of the Loudoun County Board of Supervisors, violated Davison’s First Amendment rights when she blocked him from her personal Facebook page because she had been using the page as “an extension of her office,” the Knight Institute has argued.

Twitter declined to comment.

Additional reporting by Bruce Golding