US President Donald Trump may not "block" Twitter users from viewing his online profile due to their political beliefs, a judge in New York has ruled.
District Judge Naomi Reice Buchwald in Manhattan said that blocking access to his @realDonaldTrump account would be a violation of the right to free speech.
The lawsuit against Mr Trump and other White House officials stems from his decision to bar several online critics.
The White House has yet to comment on the judge's ruling.
The case was brought by The Knight First Amendment Institute at Columbia University on behalf of seven Twitter users who had been blocked by Mr Trump for criticising him or mocking him online.
On Wednesday the judge agreed with their argument that the social media platform qualifies as a "designated public forum" granted to all US citizens.
"This case requires us to consider whether a public official may, consistent with the First Amendment, 'block' a person from his Twitter account in response to the political views that person has expressed, and whether the analysis differs because that public official is the President of the United States," the judge said in her opinion.
"The answer to both questions is no."
The judge rejected argument by Mr Trump's lawyers that the "First Amendment does not apply in this case and that the President's personal First Amendment interests supersede those of plaintiffs".
Mr Trump has over 52 million followers on Twitter, his preferred social media platform which he joined in March 2009.
He often eschews the official US presidential Twitter account, @POTUS, as well as his own White House press office, to make official announcements.
One of the people that Mr Trump blocked, Holly O'Reilly, who uses the account @AynRandPaulRyan, was blocked last May after posting a GIF of Mr Trump meeting with Pope Francis.
The photo, which some said showed the Pope glaring at Mr Trump, was captioned: "This is pretty much how the whole world sees you."
Shortly after being blocked, she told Time Magazine that "it's like FDR took my radio away", referring to Franklin Delano Roosevelt - the World War Two-era president who spoke directly to Americans with his so-called fireside chats.
Earlier in the trial, Judge Buchwald suggested the president, who was not in court, could simply mute the accounts he does not want to see.
People on Twitter are unable to see or respond to tweets from accounts that block them.
But if Mr Trump muted an account, he would not see that user's tweets but the user could still see and respond to his.
It's unclear if Mr Trump will now unblock his critics, but the judge hinted the president could face legal action if he did not comply with the ruling.
She wrote that "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 his social media director] will remedy the blocking we have held to be unconstitutional".