Image copyright @realDonaldTrump/Twitter Image caption The US president has more than 48 million followers on Twitter

A judge has advised US President Donald Trump to mute rather than block his Twitter critics after users of the service filed a lawsuit against him.

Seven people sued Mr Trump after he blocked them from seeing his tweets, arguing that it was unconstitutional.

But District Judge Naomi Reice Buchwald suggested the president mute the accounts he does not want to see.

"Isn't the answer he just mutes the person he finds personally offensive?" she asked the court in New York.

"He can avoid hearing them by muting them," she added.

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.

The president is an avid user of the social media forum, and has more than 48 million followers on his @realDonaldTrump account which he uses to praise allies and lambast critics.

The hearing on Thursday came after a lawsuit was filed in July by the Knight First Amendment Institute, a free speech group at Columbia University.

The seven Twitter users involved in the legal action say their accounts were blocked by the president, or his aides, after they replied to his tweets with mocking or critical comments.

The complaint argues that by blocking these individuals, Mr Trump has barred them from joining the online conversation.

The government says the president can choose who he interacts with on Twitter.

Katie Fallow, an attorney representing the Twitter users, said the president had blocked people "simply because they criticise him".

She said this represented "viewpoint discrimination that violates the First Amendment", which guarantees free speech under the US constitution.

One of the users, Philip Cohen, said Mr Trump blocked him after he responded to one of his tweets with a mocked up image that labelled the president a "corrupt incompetent authoritarian".

"At first I was kind of proud, like 'oh he cares about me,'" he told AFP news agency.

"But then very quickly I realized that a lot fewer people were seeing my tweets and my political efficacy, my ability to speak to my fellow citizens, was impaired by that. And I think that's not the way our government should act."

But US Department of Justice attorney Michael Baer said that the president was free to decide who he interacted with.

"The president has an associational interest in deciding who he's going to spend his time with in that setting," he said.

Lawyers on both sides said they would consider muting as a possible solution to the lawsuit.

"If there is a settlement that serves the interests of both parties, it is often considered the wiser way to go," Judge Buchwald said towards the end of the hearing.