Image caption Undercover officer Mark Kennedy denied he "went rogue" while working with the activists

Failures by police and prosecutors led to the collapse of a controversial trial involving an undercover police officer, a report has said.

The case failed when it emerged that the officer, Mark Kennedy, had infiltrated and potentially entrapped environmental activists.

A further 20 activists had their convictions quashed on appeal following the officer's unmasking.

A prosecutor is now facing disciplinary action over his alleged failings.

In a report into the affair, retired judge Sir Christopher Rose said that if the Crown Prosecution Service's reviewing lawyer, Ian Cunningham, had fully understood Mark Kennedy's role, nobody would have been tried.

He said Mr Cunningham had "relied too heavily" on what police told him about the undercover officer, who was managed by the National Public Order Intelligence Unit.

Mark Kennedy spent years underground, infiltrating green groups involved in high profile climate change protests.

WHO IS MARK KENNEDY? Mark Kennedy was a police officer who went undercover to infiltrate left-wing protest groups over seven years - groups which say they were involved in lawful demonstrations, rather than crime. Known as Mark "Flash" Stone - he had cash and a van - his secret activity emerged by accident with the chance discovery of his real passport. Unmasked, he offered to help protesters facing trial in Nottingham - evidence that ultimately led to the trial's collapse. The former policeman had relationships with women in the protest movement and travelled to eco-protests across Europe. He later told a Channel 4 documentary of his remorse, including his regret and feelings for a woman with whom he had a long affair. The official shock over the collapse of the Ratcliffe case triggered a string of inquiries - one of which has already been indefinitely postponed amid fresh allegations of improper undercover work. Michael Winterbottom, a British director, is making a film about Stone/Kennedy's life.

In 2009, Nottinghamshire Police arrested more than 100 people from a group that Kennedy had infiltrated. Twenty of them were convicted in December 2010 of plotting to shut down the massive coal-powered Ratcliffe-on-Soar power station near Nottingham.

But a second proposed trial of six more protesters collapsed after it emerged that the officer wanted to use his secret recordings to help the defence.

The collapse of the trial led the Court of Appeal to quash the convictions of the first 20 protesters - but also triggered inquiries into the affair and the role of undercover police officers.

In his report into whether prosecutors had suppressed evidence, Sir Christopher Rose said Mr Kennedy's activities and evidence were "never effectively distributed between all relevantly interested police officers or to the CPS", even though they clearly undermined the prosecution.

"[Reviewing lawyer Ian Cunningham's] statutory responsibility to keep disclosure under review meant that he should have continued asking... questions," said the report.

"All those involved in [managing] the case were well aware, or should have been if relevant guidance had been consulted, of what they needed to do."

Although the report cleared the Crown Prosecution Service of deliberately or dishonestly withholding information, the former judge criticised senior police officers in Nottinghamshire Police and the National Public Order Intelligence Unit.

He said an early case note between senior police officers described Mr Cunningham as "danger - environmentally friendly" and that the lawyer was not even initially told about the existence of Kennedy.

Sir Christopher said: "I accept that the [senior NPOIU officer] was entitled to do all he properly could to protect his asset. But at the disclosure stage, he was not entitled to withhold from the Senior Investigating Officer, the deputy SIO or Mr Cunningham material... they needed to know."

Ben Stewart, one of the 20 protesters whose convictions was quashed, denounced the report as "the whitest of whitewashes".

But the Director of Public Prosecutions, Kier Starmer, said: "I take very seriously the findings of individual failings on the part of the CPS, including failures properly to comply with disclosure obligations, failure to ask questions of the police and failure to oversee the case effectively."

Mr Starmer said he had written to the Association of Chief Police Officers, saying that in future cases police must disclose everything about undercover officers as soon as prosecutions are being considered.

The Independent Police Complaints Commission is still investigating Nottinghamshire Police's actions in the case. A separate report by the inspectorate of constabulary has been delayed until the New Year.