A police officer who for seven years lived deep undercover at the heart of the environmental protest movement, travelling to 22 countries gleaning information and playing a frontline role in some of the most high-profile confrontations, has quit the Met, telling his friends that what he did was wrong.

PC Mark Kennedy, a Metropolitan police officer, infiltrated dozens of protest groups including anti-racist campaigners and anarchists, a Guardian investigation reveals.

Legal documents suggest Kennedy's activities went beyond those of a passive spy, prompting activists to ask whether his role in organising and helping to fund protests meant he turned into an agent provocateur.

Kennedy first adopted the fake identity Mark Stone in 2003, pretending to be a professional climber, in order to disrupt the UK's peaceful movement to combat climate change. Then aged 33, he grew long hair and sported earrings and tattoos, before going on to attend almost every major demonstration in the UK up to the G20 protests in London. He was issued with a fake passport and driving licence.

Sensitive details about Kennedy's activities had been set to be raised in Nottingham crown court in legal argument relating to a case of six activists accused of conspiring to break into Ratcliffe-on-Soar coal-fired power station.

But prosecutors unexpectedly abandoned the trial after they were asked to disclose classified details about the role the undercover officer played in organising and helping to fund the protest.

Kennedy, who recently resigned from the Met, is understood to be torn over his betrayal, telling one activist that his infiltration had been "really wrong". "I'll just say I'm sorry, for everything," Kennedy said. "It really hurts."

Apparently keen for redemption, Kennedy indicated he would "help" the defendants during their trial and was in touch with their lawyer. He backed out three weeks ago, citing his concern for the safety of his family and himself.

The Met could face pressure to explain the ethics of deploying an officer so deep undercover. It has been repeatedly criticised for its handling of protests. A Metropolitan police spokesman said: "We are not prepared to discuss the matter."

Kennedy is believed to have been one of at least two undercover operatives working for the National Public Order Intelligence Unit, an agency that monitors so-called domestic extremists. He told friends each undercover spy cost £250,000 a year.

The officer was found out in October after friends, some of whom had grown suspicious about a seemingly "perfect activist", discovered a passport bearing his real name. They eventually unearthed documentary proof that he had been a policeman since around 1994, and, confronted with the evidence, Kennedy confessed. He is now living abroad.

Police arrested 114 activists at a school near Nottingham in April 2009 in a controversial operation to prevent activists from breaking into the Ratcliffe-on-Soar power station the next day.

Twenty-six activists were later charged with conspiracy to commit aggravated trespass. Of those, 20 admitted they planned to break into the power station to prevent the emission of around 150,000 tonnes of carbon.

They were convicted after failing to convince a jury their actions were designed to prevent immediate greater harm from climate change. Handing down lenient sentences last week, a judge said they had been acting with "the highest possible motives".

It is widely presumed that Kennedy tipped off police about the protest. But activists who spent four months working with Kennedy to hatch the plan now question whether he crossed a boundary and became an agent provocateur.

The allegation was set to emerge during the trial of the six defendants who – unlike the other activists – maintained that they had not yet agreed to break into the power station. According to legal papers drawn up by their lawyers, Kennedy helped to organise the demonstration from an early stage, driving on reconnaissance trips of the power station and suggesting the "best and easiest way" to get into the plant.

"He continued to participate, including hiring, paying for and driving a vehicle and volunteering to be one of two principal climbers who would attach himself to the [coal-carrying] conveyor belt. He actively encouraged participation in the action and expressed the view that he was pleased it was going to be an action of some significance," the papers say.

The documents state that planning meetings for the protest took place at Kennedy's house and he paid the court fees of another activist arising from a separate demonstration. "It is assumed that the finance for the accommodation, the hire of vehicles and the paying of fines came from police funds," they state.

Lawyers for the activists submitted their demand for material about Kennedy's role last Monday. The CPS confirmed it would not proceed with the trial, stating that "previously unavailable information" that undermined its case had come to light.

It said there was no longer sufficient evidence for a realistic prospect of prosecution.

"I have no doubt that our attempts to get disclosure about Kennedy's role has led to the collapse of the trial," said Mike Schwarz, a solicitor at the Bindmans law firm who represented the activists.

"It is no coincidence that just 48 hours after we told the CPS our clients could not receive a fair trial unless they disclosed material about Kennedy, they halted the prosecution. Given that Kennedy was, until recently, willing to assist the defence, one has to ask if the police were facing up to the possibility their undercover agent had turned native."