John Barker was an eight-year-old boy who died of leukaemia in 1968. Nineteen years later his identity was quietly resurrected by the police. The man who adopted the boy's identity, claiming it as his own, was John Dines, an undercover sergeant in the Metropolitan police's special branch.

In 1987 Dines was tasked with posing as an anti-capitalist protester, feeding intelligence to his handlers in a secret unit called the special demonstration squad (SDS). It was a controversial and morally dubious deployment that lasted five years and will now return to haunt him.

Like many SDS officers, Dines had a long-term girlfriend who was a political activist. She does not want to be identified and has asked to be referred to as Clare.

Her story lays bare the emotional trauma experienced by women whom police have described as "collateral" victims of their spy operations, as well as the risks police were taking by adopting the identities of dead children.

In 1990 the man Clare knew as John Barker asked to borrow money so he could fly to New Zealand for his mother's funeral. "The night before he got the flight to go there, he stayed at my place and kind of poured his heart out. We became emotionally close. When he got back, we got together."

There was no funeral in New Zealand and Dines had no need to borrow money. But Clare had known Dines as a fellow protester for three years and had no reason to suspect him. The couple would end up in an intimate relationship for two years.

"He said he wanted to spend the rest of his life with me and I was madly in love with him," she said. "He said he wanted us to have kids. He used to say he had once seen an elderly Greek couple sitting on a veranda gazing into the sunset, and that he pictured us growing old like that."

By the summer of 1991, as part of an exit strategy, Dines began exhibiting symptoms of a mental breakdown.

"He kept talking about how he had nobody left apart from me," Clare said. "His parents had both died. He had no brothers and sisters. The only woman that he had ever loved before me, a woman called Debbie, had left him. He said he was convinced I was going to do the same to him."

Dines gave the impression he wanted to run away to escape inner demons. "I saw him crying loads," Clare said. "He told me that he had thrown all of his mother's jewellery into a river because he thought she never loved him. He told me his parents had abused him."

In March 1992 an emotional-sounding Dines called from Heathrow airport saying he was about to fly to South Africa. After that, Clare received two letters with South African postmarks. Then her boyfriend vanished altogether.

Clare was left distraught and confused. "I was very worried about his mental state," she said. "I was also sick with worry that he might kill himself."

Clare contacted the British consulate in South Africa and frantically phoned hostels she thought he may have stayed in Johannesburg. She later hired a private investigator who could find no trace of Dines.

It was the start of a journey for the truth that would last almost two decades and eventually take her to New Zealand. It was not until 2010 that she found out for sure that the man she had loved was a police spy.

For some of the time that Clare thought her boyfriend was missing abroad, he was actually working just a few miles away. When his undercover work finished, Dines changed his mullet-style haircut and returned to a desk job at the Met headquarters in Scotland Yard where, according to a colleague, he appeared "very miserable".

In her search for clues, one of the first things Clare did was locate a copy of what she assumed was her boyfriend's birth certificate. The document confirmed the details he had always given her: it named a city in the Midlands where he was born in January 1960. She had no idea that the identity was a forgery, or that the real John Barker had died as a boy.

In April 1993, desperate after a year of searching, Clare decided to visit Barker's family home in the hope of finding any surviving relatives, but when she knocked on the door of the terrace house there was no answer. She went back later but the occupants said the family no longer lived there.

Looking back, she wonders what would have occurred if the dead child's parents had opened the door. "It would have been horrendous," she said. "It would have completely freaked them out to have someone asking after a child who died 24 years earlier."

It was another 18 months before Clare decided to inspect the national death records. "I just suddenly got this instinct. It was a whim: I thought, I'm going to go in there and look through the death records."

She recalls her horror when she discovered the real John Barker was dead. "It sent a chill down my spine," she said. "When I got the certificate itself, it was so clear. The same person. The same parents. The same address. But he had died as an eight-year-old boy."

The Guardian has been unable to find surviving relatives of the child.

The discovery turned Clare's world upside down. "It was like a bereavement but it was not something I could talk to people about. Now suddenly he didn't exist. This was a man I had known for five years, who I had lived with for two years. How could I trust anybody again?"

Clare now knew her boyfriend had lied about his identity, but still had no idea who he was. The idea that he might have been a police spy crossed her mind, but he might also have worked in corporate espionage or had a hidden criminal past. It was another 10 years of searching before she got closer to the truth.

Clare had two clues to go on. One was the name of a woman in New Zealand who Dines had told her was an aunt. The other was a letter in which he had made a curious reference to his biological father being a man he had never met, called Jim Dines.

The woman in New Zealand was not his aunt but, bizarrely, the mother of Dines's real wife. Stranger still, Jim Dines was, in fact, the police officer's real father and had brought him up in London.

Clare has no idea why the undercover police officer chose to compromise his deployment by giving Clare cryptic references to people in his real life. Perhaps he was psychologically traumatised by his dual identities and wanted to leave a trail that would allow Clare to find him.

Whatever his reason, the clues led Clare to a public archive in New Zealand. It was there, in 2003, that she made a crucial connection: a document that linked Dines with the woman he married, Debbie.

Clare instantly realised they must have been a married couple. Back in London, she ordered the couple's wedding certificate. "What hit me like a ton of bricks is that he listed his occupation as a police officer," she said. "When I read that, I felt utterly sick and really violated. It ripped me apart basically, just reading that."

Clare was now agonisingly close to the truth. She knew that Dines was a police officer when he married his wife in 1977. But there was still a possibility that he gave up his job before becoming a political activist.

She shared the evidence with friends and family. Some cautioned her against concluding Dines had been a police spy. "I remember my dad and others said: 'You're being paranoid – that would never happen in this country.'"

In 2010 she was contacted by a woman who had recently divorced a police officer who had worked undercover for the SDS shortly after Dines. The woman said her ex-husband had revealed that Dines was a fellow spy.

The Met refused to comment on the Dines case, adding: "We neither confirm nor deny the identity of any individual alleged to have been in a covert role."

Dealing with the confirmation has been an emotional ordeal for Clare. "Although it was massively painful, there was a sense of relief that I finally knew the truth. I didn't have to keep wondering." For nearly 20 years she hoped that, despite his betrayal, Dines may have genuinely loved her. It was only recently that she decided his love was also fake.

"I got out all the old letters that he sent me and read them again, with the knowledge he was an undercover police officer," she said. "What had once seemed like heart-wrenching stories in these letters, disclosures that made me really worried about his wellbeing, were completely false. That is manipulation. It is abuse."