An 88-year-old campaigner has won a landmark lawsuit against police chiefs who labelled him a "domestic extremist" and logged his political activities on a secret database.

The ruling by three senior judges puts pressure on the police, already heavily criticised for running undercover operatives in political groups, to curtail their surveillance of law-abiding protesters.

The judges decided police chiefs acted unlawfully by secretly keeping a detailed record of John Catt's presence at more than 55 protests over a four-year period.

The entries described Catt's habit of drawing sketches of the demonstrations. Details of the surveillance, which recorded details of his appearance such as "clean-shaven" and slogans on his clothes, were revealed by the Guardian in 2010.

The pensioner, who has no criminal record, is among thousands of political campaigners recorded on the database by the same covert unit that has been embedding spies such as Mark Kennedy – a police officer who infiltrated environmental protest groups – in political movements for more than a decade.

On Thursday Lord Dyson, who is the Master of the Rolls, and two other appeal court judges ordered Bernard Hogan-Howe, the commissioner of the Metropolitan police, to delete Catt's file from the database, ruling that the surveillance had significantly violated his human rights.

The judges noted that the police could not explain why it was necessary to record Catt's political activities in minute detail.

Lawyers for the police had argued that the anti-war activist regularly attended demonstrations against a Brighton arms factory near his home, which had at times descended into disorder.

The judges dismissed arguments from Adrian Tudway, the police chief then in charge of the covert unit, that police needed to monitor Catt because he "associates closely with violent" campaigners against the factory of the EDO arms firm.

They said it was "striking" that Tudway had not said the records held on the pensioner had helped police in any way.

"Mr Tudway states, in general terms, that it is valuable to have information about Mr Catt's attendance at protests because he associates with those who have a propensity to violence and crime, but he does not explain why that is so, given that Mr Catt has been attending similar protests for many years without it being suggested that he indulges in criminal activity or actively encourages those that do."

The judges added that it appeared that officers had been recording "the names of any persons they can identify, regardless of the particular nature of their participation".

Catt said: "I hope this judgment will bring an end to the abusive and intimidatory monitoring of peaceful protesters by police forces nationwide.

"Police surveillance of this kind only serves to undermine our democracy and deter lawful protest."

A similar court of appeal ruling four years ago forced the Met to remove 40% of photographs of campaigners held on another database.

In a separate ruling, which also challenged the police's practice of storing the public's personal data on databases, the three judges ordered the Met to erase a warning that had been issued against an unnamed woman.

Three years ago officers had warned the woman for allegedly making a homophobic comment about a neighbour. But she argued that police had treated her unfairly as she had not been given an opportunity to respond to the allegation.

She took legal action to prevent the Met keeping a copy of the warning notice on their files for 12 years. She feared it could be disclosed to employers when they checked her criminal record.

A Met spokesperson said: "We are disappointed with today's judgment and intend to consider it carefully before reaching a decision on whether to appeal.

"Police databases, including those containing data on domestic extremism, are maintained in compliance with the police information statutory code of practice.

"This provides a framework for the collection of information for policing purposes. The national domestic extremism unit database is maintained according to these principles."