LONDON - A British court ruled Friday that police infringed a man’s right to free expression when they showed up at his workplace to quiz him over his Twitter posts about transgender people.

Humberside Police in northeast England investigated Harry Miller in January 2019 after receiving a complaint about allegedly “transphobic” tweets, including a limerick mocking the idea that transgender women are biologically women.

He wasn’t charged with a crime, but police told him they were recording his tweets as a “hate incident.”

Miller, a former police officer, took the police force to court, accusing officers of attempting to silence him. His lawyer said Miller wasn’t prejudiced against transgender people, but had used Twitter to “engage in debate about transgender issues.”

High Court judge Julian Knowles said Friday that Miller’s tweets “were lawful and there was not the slightest risk that he would commit a criminal offence by continuing to tweet.”

“I find the combination of the police visiting the claimant’s place of work, and their subsequent statements in relation to the possibility of prosecution, were a disproportionate interference with the claimant’s right to freedom of expression because of their potential chilling effect,” the judge said.

Outside court, Miller said the ruling was “a watershed moment for liberty.”

“Go forth and tweet without fear,” he said.

Humberside Police said in a statement that “our actions in handling the incident were carried out in good faith, but we note the comments of the judge and we will take learning from this incident moving forward.“

The judge rejected a broader attempt by Miller to strike down hate speech guidelines drawn up by the College of Policing, a professional body that sets standards for police forces.

The college’s guidance defines an anti-transgender hate incident as “any non-crime incident which is perceived, by the victim or any other person, to be motivated by a hostility or prejudice against a person who is transgender or perceived to be transgender.”

The judge said the guidance “serves legitimate purposes and is not disproportionate.” But he gave Miller permission to appeal that judgment to the U.K. Supreme Court.