A federal judge in New York on Wednesday ruled that US president Donald Trump may not legally block Twitter users because doing so violates their right to free speech under the First Amendment of the Constitution.

The ruling by US district judge Naomi Reice Buchwald in Manhattan came in response to a lawsuit filed against Trump in July by the Knight First Amendment Institute at Columbia University and several Twitter users.

Buchwald agreed with the plaintiffs’ contention that the discussions arising from Trump’s tweets should be considered a public forum. She rejected an argument made by justice department lawyers that Trump’s own First Amendment rights allowed him to block people with whom he did not wish to interact.

Trump was a prolific tweeter from his @RealDonaldTrump account even before being elected in 2016 and has since made it an integral and controversial part of his presidency.

Aides reportedly have tried to rein in his tweeting, which often starts early in the morning. But he has remained unfettered and has used Twitter to promote his agenda, announce policy and attack critics, especially the media, and the investigation into possible Russian connections with his election campaign.

A spokesman for the US department of justice, which represents the president in the case, had no immediate comment. Twitter also did not immediately comment.

The Knight Institute and the individual Twitter users claimed in their lawsuit that by blocking users for their views, Trump was shutting them out of discussion in a public forum, violating the First Amendment.

When one Twitter user blocks another, the blocked user may not respond to the blocker’s tweets on the social media platform.

Media reports say that among those Trump has blocked are novelists Stephen King and Anne Rice, comedian Rosie O’Donnell, model Chrissy Teigen, actor Marina Sirtis and the military veterans political action committee VoteVets.org.

In addition to Trump, the lawsuit named his social media director, Dan Scavino, as a defendant.

“While we must recognise, and are sensitive to, the president’s personal First Amendment rights, he cannot exercise those rights in a way that infringes the corresponding First Amendment rights of those who have criticised him,” Buchwald said.

She stopped short of directly ordering Trump to unblock users, saying it was not necessary to enter a “legal thicket” involving courts’ power over the president.

“Because no government official is above the law and because all government officials are presumed to follow the law once the judiciary has said what the law is, we must assume that the president and Scavino will remedy the blocking we have held to be unconstitutional,” she wrote. – Reuters