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.
"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."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.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.
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.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.
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.
"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.
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