WASHINGTON — President Trump has been violating the Constitution by blocking people from following his Twitter account because they criticized or mocked him, a federal appeals court ruled on Tuesday. The ruling could have broader implications for how the First Amendment applies to the social-media era.

Because Mr. Trump uses Twitter to conduct government business, he cannot exclude some Americans from reading his posts — and engaging in conversations in the replies to them — because he does not like their views, a three-judge panel on the United States Court of Appeals for the Second Circuit, in New York, ruled unanimously.

The ruling was one of the highest-profile court decisions yet in a growing constellation of cases addressing what the First Amendment means in a time when political expression increasingly takes place online. It is also a time, Judge Barrington D. Parker wrote, when government conduct is subject to a “wide-open, robust debate” that “generates a level of passion and intensity the likes of which have rarely been seen.”

The First Amendment prohibits an official who uses a social media account for government purposes from excluding people from an “otherwise open online dialogue” because they say things that the official finds objectionable, Judge Parker wrote.