A police force acted unlawfully when it secretly labelled a journalist a leftwing extremist and prevented him attending the Labour party conference, the high court has ruled.

Michael Segalov took legal action against Sussex police after it refused to give him security clearance to attend last year’s conference, claiming that he could disrupt it.

The police had compiled confidential intelligence files that alleged he was a “known extreme leftwing (XLW) activist” who had demonstrated an increased willingness to take part in protests that involved breaking the law. He rejected the allegation, adding that he had never been arrested.

On Friday, Lord Justice Simon and Mr Justice Warby ruled that Sussex police had acted unlawfully when it refused to give the 25-year-old security accreditation to the conference in Brighton.

His lawyer, Ravi Naik, said: “This is a claim of genuine importance to journalists across the country and, perhaps more crucially, to set parameters on the extent to which the police can regulate press freedom.” He added that the verdict “lays down an important marker to ward off abuse of data” by the police.

Segalov has regularly written for the Guardian and other media outlets. He appears on television commenting on politics and is a contributing editor for the cultural magazine Huck.

The court heard that police had drawn on internal intelligence files that they said “established that Segalov was a known extreme activist who had taken part in demonstrations in relation to a wide range of issues”.

Police claimed that while he was not involved in criminality, Segalov was increasingly willing to engage in direct action and “might get involved in actions that would disrupt the conference”.

A Sussex police sergeant, who had had dealings with Segalov since 2013, claimed that while he was not suggesting that he had directly committed any criminal acts, he was aware that he had been involved in demonstrations or events “which had involved damage to property and/or criminal acts committed by others”.

Police had cited evidence that Segalov had met anti-deportation campaigners before a protest in 2016 in which they had released cockroaches in a Byron burger restaurant. Segalov said he had reported on the protest “purely and exclusively as a journalist” and provided information about it to the Guardian and other media.

The judges ruled that “even taken at face value, the assessment of threat does not appear to have been related to the risk to the security of the Labour party conference”.

They dismissed Segalov’s claim against a second police force, Greater Manchester, which ran a national scheme screening applicants for security clearances at party conferences. The judges decided that the refusal had been made by Sussex police.

A Sussex police spokesman said: “We accept the court’s decision that the process followed was unlawful and will be reviewing this as a result, but note the important distinction that the decision itself was not criticised as being wrong by the judges.”