The call of duty and a patriotic pedigree are given priority in Snowden’s account of his motivations – and he warns of dangers ahead

Towards the end of Edward Snowden’s memoir, he hands the narrative to his partner, Lindsay Mills, in the form of the diary she was keeping at the time he was “outing” himself as a whistleblower intent on revealing the most cherished secrets, and rampant ambitions, of the American and British spy agencies. “Ed, what have you done?” she wrote. “How can you come back from this?”

Permanent Record is Snowden’s attempt to answer these questions by doing something he finds discomforting and antithetical: breaching his own privacy, opening up what he calls the “empty zone that lies beyond the reach of the state”.

This is the space he has guarded for six years, but his account of the experiences that led him to take momentous decisions, along with the details he gives of his family background, serve as a robust defence against accusations that he is a traitor. It also offers a reminder that his disclosures of mass surveillance and bulk collection of personal information are as relevant now as they were in 2013. More so, he argues, given that private companies have become the new data behemoths.

How did Snowden become a pathfinder into the secret caverns of this new technological age? Accidentally, it seems. He comes from a family of flag-waving, security cleared patriots. One grandfather was a rear admiral, his father (“my hero”) worked for the US coastguard, and his mother had a senior backroom role with America’s National Security Agency (NSA). “Mine is a family that has always answered the call of duty,” he writes.

The CIA didn’t quite understand. The computer guy knows everything, or rather can know everything

Less surprisingly, young Eddie was a whip-smart supergeek. He was obsessed by his father’s Commodore 64 home computer and when he saw the first wave of the internet, surfed it, spending every waking moment online, learning how to code, how to hack.

In the aftermath of 9/11, he joined the US army because he “wanted to show I wasn’t just a brain in a jar”, and had he not suffered stress fractures during training, he would have become a special forces soldier. Snowden says his greatest regret was his own “reflexive, unquestioning support” for the decision to wage war after the attacks, and how it led to “the promulgation of secret policies, secret laws, secret courts and secret wars”. He found out about this parallel world working for different intelligence agencies as a contractor tasked with upgrading their antediluvian IT systems. As the spies pivoted towards cyber espionage, the top brass missed something quite important: “The CIA didn’t quite understand. The computer guy knows everything, or rather can know everything.” Snowden, it seems, was in a position to access their crown jewels.

At first, it was the incompetence that bothered him. The NSA’s security was pretty shoddy and it hardly bothered to encrypt anything. At the CIA, he spent his downtime reading intelligence reports and secret dispatches.

If there was a moment of epiphany, it came when he was asked to put together a presentation on China’s “utterly mind boggling” surveillance capabilities. As he did this, he says, he had “a sneaking sense I was looking at a mirror and seeing a reflection of America”. He was determined to find out if his fears were true. When he embarked on his own covert mission, he was just 29 and living in Hawaii. The story of how he fled to Hong Kong and then to unintended exile in Russia is fleshed out in more detail than we have seen before. Angered by what he discovered, and the dissembling of US politicians, he copied documents about the most egregious data collection programs on to tiny sim cards, which he smuggled out of the NSA facility where he was working in his trouser pocket – having decided against sticking them on to the side of his Rubik’s cube.

Snowden didn’t tell Lindsay what he was up to because he thought this would be cruel and he wanted to protect her. But leaving her was cruel and it didn’t protect her – something he profoundly regrets. I would have liked to have heard more from Lindsay and how their relationship survived the fallout. They didn’t see each other for more than a year. Two years ago, they married.

Regret is a recurring theme. Snowden is not sorry for what he did, but he laments the death of the internet he grew up with, and warns of dangers ahead, as artificial intelligence is fused with surveillance capabilities. If he is angry at his own predicament, it doesn’t show, but there is anger, and it comes in unexpected flashes; he describes Osama bin Laden as a “motherfucker”.

He also seems exasperated by people who don’t try to understand the capabilities that can now be wielded against them. Snowden calls this the “tyranny of not understanding the technology” – a dig at anyone who uses a smartphone, or a computer, without wondering how the freedom it gives them might also make them vulnerable. In his own gentle way, perhaps Snowden is throwing down the gauntlet.

He eventually decided his loyalties lay not with the agencies he was working for, but the public they were set up to protect. He felt ordinary citizens were being betrayed, and he had a duty to explain how.

And Snowdens always answer a call of duty.

• Permanent Record is published by Macmillan (£20). To order a copy go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £15, online orders only. Phone orders min p&p of £1.99.