Hundreds of spies betrayed their countries during the Cold War, often motivated by ideology, or financial reward. Jeff Carney was different - he was a lonely, gay US airman who dreamed of a new life in East Germany. Years later, he sees parallels between his story and that of Chelsea, formerly Bradley, Manning.

It was the middle of the night in April 1983, when Jeff Carney approached Checkpoint Charlie. His steps grew shaky and he began to sweat.

As he stepped across the painted white line that separated East and West Berlin, he thought he was safe. He thought he was going to live in the east. He couldn't have been more wrong.

East German border guards took him to a small bare room with a cheap desk, a couple of chairs and a German-English dictionary.

"My intent when I went over that white line that night was not in any way to become a spy. My intent was simply to get away," he says.

Image caption The tree where Carney used to leave documents for his handlers

"I requested to speak to representatives of the East German government and when they came to me they weren't just any representatives, they were the men in the leather jackets so to speak. They were spies."

This was not the reception he had expected. Carney was 19 and had just returned to his posting at Marienfelde in Berlin after a trip home.

His family's problems depressed him - he had joined the Air Force at the age of 17 just to get away - and he spent the evening drinking alone in Berlin, ending the night at one of the city's gay bars.

Carney also hated his job. He felt unwanted and resented the military's ban on homosexuality.

There was nothing ideological about his decision to defect - it was an impulsive move. He thought he would be welcomed with open arms and given a new home in the east.

"I was foolish enough to believe that these people might actually be interested in me as a person. We know today that that's not correct - I was only worth what I had access to," says Carney.

How much damage did he do? Carney compromised Canopy Wing, a highly classified plan designed to disable Soviet communications in the event of hostilities. Part of Nato's strategy was to rely on electronic warfare to deny the airwaves to the Soviet command-and-control structure, thereby handicapping the front-line forces' ability to send or receive orders. It was a highly sophisticated scheme that would render the adversary electronically "blind". After Carney's defection a damage assessment exercise was carried out. This would have assumed that all the material he had had access to was compromised. Damage control would have included replacing or upgrading Canopy Wing. One estimate of the financial cost of this breach of security, and the new investment required, amounted to $14.5 billion (£9.2bn). Nigel West, author of the Historical Dictionary of Cold War Counterintelligence

The East Germans ordered him to go back to his job and become a spy. If he didn't, his commander would be informed where he had been that night.

"To say I was disappointed was an understatement," he says. In his newly published book, Against All Enemies, he writes that he had "sold his soul and now had to commit, for better or for worse".

So Carney's life as a spy began.

The US Air Force had hired him because of his language skills - his job was to listen to East German communications and translate what he heard. Although Carney did not hold a high rank, as a linguist he worked in an environment where sensitive information was discussed.

He smuggled classified documents out of the listening post in his boots and trousers giving them to his handler "Ralph", or leaving them in an ammunition box by a tree in the forest at Eiskeller, on the north-west edge of Berlin.

His contacts called him Uwe - and gave him a camera hidden in a can of Lipton Iced Tea to photograph military papers.

Although he handed secrets to the East German secret police, the Stasi, he argues that he did not betray the American people because "betraying your country and betraying your government are two different things".

He says he helped to maintain world peace and that he never handed over anything that would harm the US.

Image caption The US National Security Agency has blacked out some parts of Carney's book

One day he heard about a US manoeuvre designed to make Soviet forces think they were being attacked. By monitoring the Soviet response to the emergency, the US would gather priceless information about their electronic communications.

But Carney says it was possible that "something could have gone wrong". If the Soviets really believed they were being attacked, lives could have been lost.

Spying in the GDR The East German secret police, the Stasi, employed 85,000 full-time officers at its height

The Stasi had records on a third of the GDR's population

The Russian President, Vladimir Putin, was a KGB spy in East Germany from 1985-1990

Carney was spying from 1983-1985 and lived in the GDR from 1985-1991

"We know today that we were very close to nuclear destruction in 1983, even if people don't wish to talk about it. People say, 'Yeah, well it didn't happen.' Well it could have," he says.

He finished his shift, then hurried to send a message of warning.

In all, he says his two years of spying cost the US up to $15bn (£9.6bn), an estimate mirrored in the Historical Dictionary of Cold War Counterintelligence.

Suddenly, in 1984, he was told that his Berlin posting was coming to an end and he would be sent back to Texas, in the US.

For a while, he continued spying, making trips to Mexico and Brazil to meet his contacts.

But Carney's bosses had begun to question his mental health. In Berlin he had been ordered to see a doctor who diagnosed him with paranoia. Now his superiors referred him to a mental health unit and took away his access rights at work.

Carney decided it was time for drastic action. He booked a plane ticket to Mexico and turned up at the East German embassy unannounced, demanding they contact Berlin.

Find out more Jeff Carney spoke to World Update on the BBC World Service. More from World Update More from the BBC World Service

He still wanted the same thing he had wanted on that spring night two years earlier in Berlin - to live in East Germany.

He was smuggled out of Mexico and taken to Cuba, then on to Prague and finally to the German Democratic Republic (GDR).

He was given a new name, Jens Karney, an East German passport and somewhere to live.

His first place was a one-room apartment in a high-rise block with nothing but a black-and-white television and the complete works of Lenin translated into German.

It was far from perfect and he later realised the flat was bugged. In his autobiography he writes, "I was often lonely, but I was never alone".

He himself was given work listening to bugged conversations.

But when the Berlin Wall came down, things changed again. The Stasi unravelled and he took a job as a train driver on the Berlin subway.

In time, the Americans caught up with him. They seized him in the middle of a street in broad daylight in 1991, and flew him back to the US, where he was sentenced to 38 years in prison. That was reduced to 20 years after he co-operated in debriefings.

Carney served nearly 12 years behind bars and now lives with an adopted son in Ohio. He is unemployed and uses his time to paint.

He sees echoes of his own story in that of Chelsea, formerly Bradley, Manning - the US soldier sentenced to 35 years for leaking classified documents to Wikileaks.

Image caption Carney sees some similarities between his story and that of Chelsea, formerly Bradley, Manning

"When I look at Manning's case I see some similarities - age, experience level, first time overseas, faced with huge responsibility, top secret security clearance at a very young age," says Carney.

Both also struggled with their sexual identities, and were obliged to keep this part of their life secret from the military.

"The differences are, of course, that we are now in the age of computers, while then we lived in the age of paper and pencil," says Carney.

Now approaching 50, he has had plenty of time to think about what he describes in his book as "a long, insane journey that never seemed to stop".

He stands by his actions but "at an emotional level there is a lot of regret because I know what I did hurt people," he says - referring to his family and former colleagues.

So, if he could go back 30 years would he do it differently? No, he says.

"If I was faced with the exact same constellation of events, then I would probably make the same decisions."

Jeff Carney spoke to World Update on the BBC World Service.

You can follow the Magazine on Twitter and on Facebook