NEW YORK — President Donald Trump violates the First Amendment when he blocks critics on Twitter for political speech, a judge ruled Wednesday.

In ruling, the judge said no government official — including the president — is above the law.

U.S. District Judge Naomi Reice Buchwald in Manhattan stopped short in her written decision of ordering Trump or a subordinate to stop the practice of blocking critics from viewing his Twitter account, saying it was enough to point out that it was unconstitutional to continue to do so.

“A declaratory judgment should be sufficient, as no government official — including the President — is above the law, and all government officials are presumed to follow the law as has been declared,” Buchwald wrote.

The case was brought last July by the Knight First Amendment Institute at Columbia University and seven individuals blocked by Trump after criticizing the Republican president.

The Justice Department did not immediately respond to a message. A government lawyer did not respond to an email request for comment.

Jameel Jaffer, the Knight Institute’s executive director, said in a release that his organization was pleased.

“The president’s practice of blocking critics on Twitter is pernicious and unconstitutional, and we hope this ruling will bring it to an end,” he said.

The lawsuit was filed after Trump blocked some individuals from @realDonaldTrump, a 9-year-old Twitter account with over 50 million followers.

Justice Department lawyers had argued that it was Trump’s prerogative, no different from the president deciding in a room filled with people not to listen to some.

Buchwald ruled that the tweets were made in a public forum.

“The President presents the @realDonaldTrump account as being a presidential account as opposed to a personal account and, more importantly, uses the account to take actions that can be taken only by the President as President,” the judge said.

After a hearing this year, the judge had suggested that Trump mute rather than block some of his critics. At the time, a Justice Department attorney agreed that muting would enable Trump to avoid a tweet he doesn’t want to read.

Twitter users can block people, which prevents them from seeing the user’s feed while logged in. Or they can mute the person, which keeps the user from seeing that person’s tweets and reply messages in their feed.