President Donald Trump in the Oval Office of the White House in Washington. File photo: AP Photo/Alex Brandon.

Washington - A US appeals court on Tuesday ruled that President Donald Trump cannot block accounts on Twitter because he disagrees with them, saying it was a violation of First Amendment protections on free speech.

The Second Circuit Court, in affirming a previous ruling, noted that the president uses his Twitter account for official purposes, including the dissemination of policy and that the White House itself has described the account's content as official.

The New York court ruled that it was discriminatory, and therefore illegal, for the president to block critics over the expression of their views.

The case is likely to help set the rules for how public online spaces work for office holders.

The ruling went into significant detail about how Twitter works and noted workarounds for people who are blocked by certain accounts. But it said that these measures were insufficient in the Trump case, to ensure constitutional protections of free expression.

The suit was filed by several people who were blocked by the Trump account, apparently after replying with critical remarks to tweets by the president from his @realDonaldTrump account.