There are two distinct images of Mark Kennedy that have emerged in the press. The first is a long-haired, unshaven, multi-earringed rebel – that is Kennedy the undercover cop in his role as eco-activist "Mark Stone". The second is a man with short hair, swept to the side, clean-shaven, so spruce you can almost smell the soap – the "real" Mark Kennedy, returned from life undercover.

Today, it takes me a while to recognise him. He could be a composite – the hair is longer and unkempt, the face unshaven, tattoos are on display under his rolled-up sleeve. He seems to be morphing back into the eco-activist before my eyes.

Kennedy was an undercover police officer who spent seven years infiltrating a group of environmental activists under the alias Mark Stone. In 2009, as protesters planned to occupy and temporarily shut down one of Britain's biggest coal-fired power stations at Ratcliffe-on-Soar in Nottinghamshire, Kennedy passed on the information to his handlers. Nottinghamshire police subsequently arrested 114 people in a late-night swoop. Among them was "Stone" himself, who faced a prison sentence for conspiracy to commit aggravated trespass. Kennedy was trapped – if he was not charged, it would blow his cover, yet he couldn't appear in court as somebody who did not actually exist. In the end, the case collapsed, leaving a trail of collateral damage – up to £1m lost on the trial, hundreds of thousands wasted on his surveillance work, a community torn apart, lives shattered.

The story led to four ongoing inquiries about the nature of undercover policing and questions in parliament: did the environmental protesters need to be monitored so closely? Wasn't it a waste of police time and taxpayers' money? Were police acting as agents provocateurs? Did they have any right to inveigle their way into people's lives in such a manner? The story caught the popular imagination, not least because it emerged that for many of his years undercover, Kennedy – who was married with children – was involved in a serious relationship with one of the activists.

What kind of man could do that: nurture, befriend and ultimately love a group of people, then betray them? Kennedy, 41, wants to tell his side of the story. But at times he no longer seems sure what that story is.

He grew up in Orpington, Kent. His mother was a housewife, his father a traffic police officer. At 19, Kennedy also joined the police. He considered himself a modern cop with modern attitudes – he had no time for the old racist views, was sympathetic to protesters in the environmental movement, and believed the job of the police was to enable society to operate fairly and democratically. He worked initially in uniform, then undercover in south London, buying drugs and weapons from dealers and passing information back to Scotland Yard. He was good at the job and was headhunted by the National Public Order Intelligence Unit, a secret body that runs an intelligence database of political activists. They asked him to help expose race-hate crimes – more undercover work. This was just the kind of thing he had joined the police to do. Again, he was successful. It was then suggested that he hook up with a group of environmental activists in Nottinghamshire. Yes, it was infiltration and, yes, it involved spying on people he regarded largely as good guys, but he convinced himself he was on the side of the angels – if he could tip the wink to his handlers about extremists and demonstrations, they could be policed efficiently and he would be working as a good officer while assisting a movement to which he was sympathetic. Of course, if his fellow activists had known this at the time, they would have regarded it all very differently.

"My role was to gather intelligence so appro priate policing could take place," Kennedy says. "It wasn't to prevent people from demonstrating. I met loads of great people who would go out every weekend and show their concern and demonstrate. Then there were other people who would want to take things further and maybe want to break into somewhere or destroy things, and then you start infringing on the rights of other people to go about their lawful business."

Kennedy still talks like an officer. His sentences are punctuated with words such as "tasked", "gatherings" and "proportionate policing". We meet at the offices of the publicist Max Clifford, whose help Kennedy sought when he reached a nadir. He had lost everything – his old friends, his family, his activist friends. I had expected a cool, confident man – a James Bond or Jason Bourne – but Kennedy is fidgety and diffident. His neck reddens as he talks and only one eye focuses because of a childhood accident (at two, he climbed inside a cardboard box and a loose staple ripped an ocular muscle). After a few minutes he starts to stammer – a schoolboy affliction that has only recently returned.

It was not easy to immerse himself among the activists, he says. They were a group of close-knit friends, many of whom had known each other since school. He went to meetings and marches, and gradually became accepted. The more involved he became, the more he changed physically. His hair grew long enough to wear in a ponytail, he got more piercings and tattoos. Gradually, he proved himself an indispensable comrade – he could drive (many activists couldn't or wouldn't), he had money (made, he said, by drug dealing in Pakistan – he told the activists he now wanted to turn his life around), he was a skilled climber and, perhaps most importantly, he was popular.

Somehow, he successfully managed both lives. While Stone had a thrilling time visiting 22 countries on a false passport, demonstrating against the building of a dam in Iceland, touring Spain with eco-activists, picketing arms fairs in London and penetrating anarchist networks in Germany and Italy, Kennedy quietly slipped information back to the police, even managing occasionally to get back to visit his wife, Edel, and two young children in Ireland. The couple were estranged, but maintained they were together for the sake of the children (four and two when he went undercover in 2002). If they asked, he would tell the activists that he was working away for a few days as an industrial climber.

Did he have to be an incredibly good liar to do this job? "Yes." Was he always a good liar? "Not in that sense. I was lying because it was my job to lie. I'm not a dishonest person. I had to tell lies about who Mark Stone was and where he was from for it to be real." He pauses. "To be fair, a lot of the things you do, say and talk about are very much based upon who you are as a person and the places you've been to and the things you've done, because five years later somebody will go, 'Ah, Mark, didn't you say you went here?' and you have to remember that. So a lot of the things I would talk about were pretty true."

Such deceit was on a different level from what he'd practised on the streets, buying drugs and guns. "If I'm going to buy a kilo of coke, the dealer doesn't really want to know me that well; it's all about the commodity. But this is different. People don't actually want anything from you – all they want is to know you and be your friend."

Is it possible to do the job without becoming paranoid? "I'd use a different phrase. I never became complacent." That's a very different phrase, I say. He ums and ahs and stutters his way to a conclusion. "I never… I always liked to... I suppose I was a little bit paranoid." Can you do the job without it mentally unbalancing you? "I don't know." Where does Kennedy end and Stone begin? "Well... there is no line. You just can't say." He finally reaches a conclusion of sorts: "I always have understood and had a concern for the issues I was infiltrating. I don't think you could do this work if you didn't care about the climate."

Perhaps that is what ultimately made life impossible for Kennedy: he wanted to honour both sides – be the honest cop and the genuine activist. But in the end he was caught in the middle, despised as a Judas by both sides.

Kennedy experienced heavy-handed policing first-hand. In 2006 he was beaten up by officers on the perimeter fence of the Drax power station. He says he was trying to protect a woman being hit on the legs with a baton when he was jumped by five uniformed officers – they were there only because he had tipped off his handlers. "They kicked and beat me. They had batons and pummelled my head. One officer repeatedly stamped on my back. I had my finger broken, a big cut on my head and a prolapsed disc." There were plenty of other incidents, he says. "I experienced a lot of unjust policing. At times, I was appalled at being a police officer."

But he says that some of the best things in his life also happened as Mark Stone – and not just the dramatic stuff. "There are some amazing social centres that are all voluntary-based. Take the Sumac Centre in Nottingham, a community garden that provides free food. If you had a social centre like that in every city, it would be great. And I was fortunate enough to be involved in that and see how it works."

And this became his community? "Yes. So many people I knew, or Mark Stone knew, became really good friends. It wasn't just about being an activist all the time."

I ask if he ever wanted to be Stone, and he gives a surprising answer. No, he says, because it was so frustrating failing to achieve what he had set out to do. "There was a lot of commitment and effort and tears put into things that didn't change anything." The activists were too conservative? "Yeah, I would say, and just very small in numbers." Actually, he says, they were a bit useless at the most basic things – an effective group of protesters needs a number of competent climbers, to scale fences and gain access to buildings and power plants, and there were hardly any. Recently, it was announced there wouldn't be a climate camp this year, and that horrifies him. What better time to discuss the environment and policing and all the issues that have come about with his case?

It's bewildering listening to Kennedy make the case for a more radical and committed group of ecowarriors. The bottom line is that he went in to betray them and did just that. Does he feel guilty? "It's something I find very hard to think about. When you're on the front line in a riot situation, the people around you are your buddies. Everybody looks out for each other, and I experienced that on numerous occasions. There were people who, if they had only a couple of quid left, would buy you a pint. So, yes, there are some great people who didn't need to be reported on. They believed I was something else, and that hurts a lot."

And then there are the women. Those in the environment movement claim Kennedy had many sexual relationships through the years, and some believe it was a systematic means of gaining trust and gathering intelligence. One woman with whom he had a relationship overseas said she felt "violated" when he was outed as a police officer. Kennedy maintains there were only two relationships, one of which was serious.

Look, I say, it's easy to talk about the trauma of betraying a guy who buys you a pint, but when it's a lover, surely that's on a different level? Silence.

"For me, that whole kind of incident..." He starts again. "That's not the right word. I felt in some ways that I was really alone, that I was the only person as an undercover officer who had ever done that; subsequently, I discovered everyone was doing it. The person I had the relationship with is an amazing person, a really amazing person. The love I shared with her and the companionship we shared was the realest thing I ever did." More real than his marriage? "Yeah, there were no lies about that at all," he says without irony.

How did he feel when he was in bed at night? Was there not part of him desperate to confess? "Yes, all the time. All the time. Yes." But how could he continue in a relationship with someone who might be the love of his life and know it's all based on a lie? "It's one for the psychologists," he says quietly. "It's just how it was. I don't know." Did he never think of coming clean, begging forgiveness and leaving the police? "No, no. I'm not saying it didn't cross my mind, it just wasn't a realistic proposition. It would never have worked." Because he'd have ended up rejected by both sides? "Absolutely." He looks at me. "You know, our relationship was remarked upon in the activist community as being a great relationship."

Things reached a head in April 2009, when the activists planned to break into the Ratcliffe-on-Soar power plant. It was initially suggested that "Stone" climb the power plant, but he refused. This was Kennedy the good policeman – if he led the protesters, any subsequent case could collapse because he would be regarded as an agent provocateur. He says he told his handlers that he had passed on all the necessary information and didn't want to be part of the protest, but they told him they wanted him there. He eventually agreed to drive a lorry. He recorded two meetings held at Iona school on 12 and 13 April, where protesters discussed shutting down the plant, and passed on the recordings. At one point activists heard there had been a leak and that security had gathered at the power station. According to activists, it was Kennedy who went to recce the station and reported back that all was clear.

On 14 April, the day before the planned takeover, the police arrested 114 activists. While the other 113 shared one law firm, Bindmans, Kennedy's handlers said he did not need one because he was a police officer. "I said, look, everybody else has got a solicitor, Mark Stone hasn't – it looks really odd. They said, don't worry about it, and I said, well, I have to worry about it because I'm now on bail to go back to be re-interviewed." The Nottinghamshire detectives had no idea that an undercover officer was involved. "As far as they were concerned, they were interviewing Mark Stone, a thorn in their side for the past seven years – he's a catch, let's make sure we push charges."

Every day for three months, Kennedy phoned his handlers to ask what was happening, and heard nothing. Eventually, a week before the day on which he and 26 others had been told they would be charged, the case against him was dropped. He had suggested that if he was released without charge, the other drivers should be, too, to avoid suspicion, but he was ignored and all the remaining 26 activists were charged. It left him in an impossible situation. "It totally exposed me. To sit in a pub with everyone else and for them to say, 'How did you get off?' What could I say? I didn't say anything. That was hugely stressful. Certainly it raised a lot of questions among people."

Soon after the case was dropped, he received a message from his handlers: the surveillance operation was being dropped and he was to tell the activists that he was leaving to visit family in America for an indefinite period.

When he returned to the Met in October 2009, he discovered two alarming things – one, his time undercover had left him out of touch; and two, he was now a pariah in police circles. "Over seven years, there was no training or keeping me up to speed with what was going on in the police. So when I went back, I probably wasn't even qualified to drive a Panda, didn't know how to use a radio. I didn't know how any of the systems worked. I went for an interview with the personnel department and they didn't even have my file." When they asked Kennedy what he wanted to do now, he told them, "I need a role that keeps me off the streets, reasonably covert, some kind of detective job." That was all very well, they said, but he'd have to apply like anyone else. "They said, 'We can't give you a job on merit of having done a good job before. You're not really qualified to do anything.'

"I was not looked after at all. I didn't think there was anything left for me in the police, so I left." Kennedy does not believe he is alone. He says he has talked to other former undercover officers who feel they were cast aside on their return to mainstream policing and later left the service suffering from post-traumatic stress.

In early 2010, he returned as Mark Stone to his friends in Nottingham. Perhaps he didn't know where else to go. He wanted to try to make things work with his girlfriend – or at the very least provide a more satisfactory ending to their relationship and his years among the protesters. (He had done a course on servicing wind turbines, and told his old friends he was going to travel the world doing that.) But when they were on holiday last July, his girlfriend came across a passport belonging to Mark Kennedy in the glove compartment of his van. Again, he lied and told her he had many passports from his drug smuggling days.

She might have given him the benefit of the doubt, but when she told the other activists, they did not. They demanded a meeting in which he was quizzed for four hours. "I was absolutely shitting myself. They sat in a semicircle around me. It was hugely menacing. I told them nothing to start with. They just kept saying they knew I was a cop, that I was married with kids. They knew my mum. They knew my home address." Eventually he broke down, and that was when they brought in his girlfriend. "The look of devastation on her face destroyed me."

He was asked to make a statement confessing everything. He said he would think about it, then ran away. Was it a relief that he was forced to come clean? He nods. "Yeah, a huge relief." He stops to correct himself. "Later it became a relief, after the initial shock."

He hoped to manage his own public outing, but was overtaken by events. Last December, 20 of the charged activists were convicted of trespass offences. Then, in January, the case of the remaining six collapsed. There were a number of stories circulating as to why – and Kennedy was at the centre of them all. One suggested that he had gone native – in one recorded phone conversation, he suggested he could give evidence for the defence and said the police tactics with which he was involved were like using "a hammer to crack a nut". Another version of events suggested that by taking such an active role in the protest, he had become an agent provocateur. But, ultimately, the case seems to have collapsed for less noble reasons – it is thought the CPS realised that the evidence Kennedy had recorded at the school actually helped the activists, showing that most were still making up their minds about whether and how to participate. If that was the case, the prosecution could not win – if they used the evidence, they undermined their own case; if they didn't use it, the defence would accuse them of non-disclosure.

Kennedy found himself front-page news. There was a rush of stories about him and, appropriately enough, it was impossible to distinguish fact from fiction. It was suggested that he had set up his own companies after leaving the police (true – he says he planned to start a business abseiling down skyscrapers to clean their windows) and that he had worked in private security spying on the activists after he had left the police (false, he insists – he was asked to advise a company on trends in activism, but says he declined).

According to Kennedy, the police did their utmost to distance themselves from him, telling reporters in off-the-record briefings that he was "a bad apple" and wholly unrepresentative of undercover officers. But a week after he was exposed in the national press, a number of similar stories emerged, including that of undercover officer Jim Boyling, who had married an activist he met while infiltrating Reclaim The Streets.

By now Kennedy had nowhere left to run. Every bridge was burned – he had not seen his children for three months, and neither the police nor the protesters wanted anything to do with him. He wasn't sleeping, barely eating, and was terrified. He was hiding in America, convinced his former police bosses were looking for him and that activists wanted revenge. A group of German anarchists said they hoped Kennedy "spends the rest of his life looking over his shoulder. That is the minimum price he should have to pay." In the US he told a psychiatrist that he was suicidal.

Kennedy returned to England in a desperate state but, having no fixed address, he could not sign up to a GP. While undercover, he should have received an assessment from a police psychologist every three months, but claims he went two whole years without even one. He also says he received no counselling from the police when he was removed from undercover work. When asked if they were remiss in their pastoral care, both the Metropolitan police and National Public Order Intelligence Unit declined to comment in light of ongoing inquiries.

"I felt hugely alone," Kennedy says. He looks away. "Still do. It was a really dark time. I had two choices: I was either going to top myself or try to get some help."

All the time we've been talking, I've wondered one thing: how would he have felt if his girlfriend had ended up in prison because of his actions? For the first time he seems shocked by a question. "She was nothing to do with anything." Why not? "She was doing something else." By chance, she was not involved in that particular protest. And if she had been? "It didn't occur to me."

As for the future, he hasn't a clue what it holds. There is a documentary being made about him, talk of a movie, even, but he knows that's not going to see him through the rest of his working life. He says he'd like to use his experience to show people that police officers and activists don't always fit a neat stereotype, but he's not sure how. For now, though, he says, he has plenty of work to do on himself. This week he is visiting his family to try to make a fresh start with the children. He says they were distraught to see him in the newspapers, and admits that his daughter is "quite frosty" with him.

Does he think people will ever trust him again? "Do you mean people I used to associate with? No, never. Never. I shattered that trust, I accept that."

Does he think he will ever be able to trust himself again? "In what way?" he asks. Well, I say, is he confident that he knows who he is now?

"No, not at all. Deep down, I know I have these core values, but it's going to be a long process to find out who I am."