In late December 2001, someone calling themselves TheTrueHOOHA had a question. He was an 18-year-old American male with impressive IT skills and a sharp intelligence. His real identity was unknown. Everyone who posted on Ars Technica, a popular technology website, did so anonymously.

TheTrueHOOHA wanted to set up his own web server. It was a Saturday morning, a little after 11am. He posted: "It's my first time. Be gentle. Here's my dilemma: I want to be my own host. What do I need?"

Soon, regular users were piling in with helpful suggestions. TheTrueHOOHA replied: "Ah, the vast treasury of geek knowledge that is Ars." He would become a prolific contributor; over the next eight years, he authored nearly 800 comments. He described himself variously as "unemployed", a failed soldier, a "systems editor", and someone who had US State Department security clearance.

His home was on the east coast of America in the state of Maryland, near Washington DC. But by his mid-20s he was already an international man of mystery. He popped up in Europe – in Geneva, London, Ireland, Italy and Bosnia. He travelled to India. Despite having no degree, he knew an astonishing amount about computers. His politics appeared staunchly Republican. He believed strongly in personal liberty, defending, for example, Australians who farmed cannabis plants.

At times he could be rather obnoxious. He called one fellow-Arsian, for example, a "cock"; others who disagreed with his sink-or-swim views on social security were "fucking retards".

His chat logs cover a colourful array of themes: gaming, girls, sex, Japan, the stock market, his disastrous stint in the US army, his negative impressions of multiracial Britain (he was shocked by the number of "Muslims" in east London and wrote, "I thought I had gotten off of the plane in the wrong country… it was terrifying"), the joys of gun ownership ("I have a Walther P22. It's my only gun but I love it to death," he wrote in 2006). In their own way, the logs form a Bildungsroman.

Then, in 2009, the entries fizzle away. In February 2010, TheTrueHOOHA mentions a thing that troubles him: pervasive government surveillance. "Society really seems to have developed an unquestioning obedience towards spooky types… Did we get to where we are today via a slippery slope that was entirely within our control to stop? Or was it a relatively instantaneous sea change that sneaked in undetected because of pervasive government secrecy?"

TheTrueHOOHA's last post is on 21 May 2012. After that, he disappears, a lost electronic signature amid the vastness of cyberspace. He was, we now know, Edward Snowden.

Edward Joseph Snowden was born on 21 June 1983. His father Lonnie and mother Elizabeth – known as Wendy – were high-school sweethearts who married at 18. Lon was an officer in the US coastguard; Snowden spent his early years in Elizabeth City, on North Carolina's coast. He has an older sister, Jessica. When Snowden was small – a boy with thick blond hair and a toothy smile – he and his family moved to Maryland, within DC's commuter belt.

As his father recalls, Snowden's education went wrong when he got ill, probably with glandular fever. He missed "four or five months" of class in his mid-teens. Another factor hurt his studies: his parents were drifting apart. He failed to finish high school. In 1999, aged 16, Snowden enrolled at Anne Arundel community college, where he took computer courses.

In the aftermath of his parents' divorce, Snowden lived with a roommate, and then with his mother, in Ellicott City, just west of Baltimore. He grew up under the giant shadow of one government agency in particular. From his mother's front door, it takes 15 minutes to drive there. Half-hidden by trees is a big, green, cube-shaped building. An entrance sign off the Baltimore-Washington Parkway reads: "NSA next right. Employees only." The Puzzle Palace employs 40,000 people. It is the largest hirer of mathematicians in the US.

For Snowden, the likelihood of joining was slim. In his early 20s, his focus was on computers. To him, the internet was "the most important invention in all human history". He chatted online to people "with all sorts of views I would never have encountered on my own". He wasn't only a nerd: he kept fit, practised kung fu and, according to one entry on Ars, "dated Asian girls".

The 2003 US-led invasion of Iraq prompted Snowden to think seriously about a career in the military. "I wanted to fight in the Iraq war because I felt like I had an obligation as a human being to help free people from oppression," he has said.

The younger Snowden was into computers, kung fu – and even tried his hand at amateur modelling. Photograph: © TheTrueHOOHA

The military offered what seemed, on the face of it, an attractive scheme, whereby recruits with no prior experience could try out to become elite soldiers. In May 2004, Snowden took the plunge and enlisted, reporting to Fort Benning in Georgia. It was a disaster. He was in good physical shape but an improbable soldier, shortsighted and with unusually narrow feet. During infantry training, he broke both his legs. After more than a month's uncertainty, the army finally discharged him.

Back in Maryland, he got a job as a "security specialist" at the University for Maryland's Centre for Advanced Study of Language. It was 2005. (He appears to have begun as a security guard, but then moved back into IT.) Snowden was working at a covert NSA facility on the university's campus. Thanks perhaps to his brief military history, he had broken into the world of US intelligence, albeit on a low rung. The centre worked closely with the US intelligence community, providing advanced language training.

In mid-2006, Snowden landed a job in IT at the CIA. He was rapidly learning that his exceptional IT skills opened all kinds of interesting government doors. "First off, the degree thing is crap, at least domestically. If you 'really' have 10 years of solid, provable IT experience… you CAN get a very well-paying IT job," he wrote online in July 2006.

In 2007, the CIA sent Snowden to Geneva on his first foreign tour. Switzerland was an awakening and an adventure. He was 24. His job was to maintain security for the CIA's computer network and look after computer security for US diplomats. He was a telecommunications information systems officer. He also had to maintain the heating and air-con.

At the time, the figure who most closely embodied Snowden's rightwing views was Ron Paul, the most famous exponent of US libertarianism. Snowden supported Paul's 2008 bid for the US presidency. He was also impressed with the Republican candidate John McCain. He wasn't an Obama supporter as such, but he didn't object to him, either.

Once Obama became president, Snowden came to dislike him intensely. He criticised the White House's attempts to ban assault weapons. He was unimpressed by affirmative action. Another topic made him even angrier. The Snowden of 2009 inveighed against government officials who leaked classified information to newspapers – the worst crime conceivable, in Snowden's apoplectic view. In January of that year, the New York Times published a report on a secret Israeli plan to attack Iran. The Times said its story was based on 15 months' worth of interviews with current and former US officials, European and Israeli officials, other experts and international nuclear inspectors.

TheTrueHOOHA's response, published by Ars Technica, is revealing. In a long conversation with another user, he wrote the following messages:

"WTF NYTIMES. Are they TRYING to start a war?"

"They're reporting classified shit"

"moreover, who the fuck are the anonymous sources telling them this? those people should be shot in the balls"

"that shit is classified for a reason"

"it's not because 'oh we hope our citizens don't find out' its because 'this shit won't work if iran knows what we're doing'"

Snowden grew up under the giant shadow of Fort Meade, Maryland, the NSA’s headquarters. Photograph: Getty Images

Snowden's anti-leaking invective seems stunningly at odds with his own later behaviour, but he would trace the beginning of his own disillusionment with government spying to this time. "Much of what I saw in Geneva really disillusioned me about how my government functions and what its impact is in the world. I realised that I was part of something that was doing far more harm than good," he later said.

In February 2009, Snowden resigned from the CIA. Now he was to work as a contractor at an NSA facility on a US military base in Japan. The opportunities for contractors had boomed as the burgeoning US security state outsourced intelligence tasks to private companies. Snowden was on the payroll of Dell, the computer firm. The early lacunae in his CV were by this stage pretty much irrelevant. He had top-secret clearance and outstanding computer skills. He had felt passionately about Japan from his early teens and had spent a year and a half studying Japanese. He sometimes used the Japanese pronunciation of his name – "E-do-waa-do" – and wrote in 2001: "I've always dreamed of being able to 'make it' in Japan. I'd love a cushy .gov job over there."

Japan marked a turning point, the period when Snowden became more than a disillusioned technician: "I watched as Obama advanced the very policies that I thought would be reined in." Between 2009 and 2012, he says he found out just how all-consuming the NSA's surveillance activities are: "They are intent on making every conversation and every form of behaviour in the world known to them." He also realised that the mechanisms built into the US system and designed to keep the NSA in check had failed. "You can't wait around for someone else to act. I had been looking for leaders, but I realised that leadership is about being the first to act." He left Japan for Hawaii in 2012, a whistleblower-in-waiting.

Snowden's new job was at the NSA's regional cryptological centre (the Central Security Service) on the main island of Oahu, near Honolulu. He was still a Dell contractor, working at one of the 13 NSA hubs devoted to spying on foreign interests, particularly the Chinese. He arrived with an audacious plan to make contact anonymously with journalists interested in civil liberties and to leak them stolen top-secret documents. His aim was not to spill state secrets wholesale. Rather, he wanted to turn over a selection of material to reporters and let them exercise their own editorial judgment.

According to an NSA staffer who worked with him in Hawaii and who later talked to Forbes magazine, Snowden was a principled and ultra-competent if somewhat eccentric colleague. He wore a hoodie featuring a parody NSA logo. Instead of a key in an eagle's claws, it had a pair of eavesdropping headphones, covering the bird's ears. He kept a copy of the constitution on his desk and wandered the halls carrying a Rubik's cube. He left small gifts on colleagues' desks. He almost lost his job sticking up for one co-worker who was being disciplined.

In Hawaii, by early 2013, Snowden's sense of outrage was still growing. But his plan to leak appeared to have stalled. He faced too many obstacles. He took a new job with the private contractor Booz Allen Hamilton, yielding him access to a fresh trove of information. According to the NSA staffer who spoke to Forbes, Snowden turned down an offer to join the agency's tailored access operations, a group of elite hackers.

On 30 March, in the evening, Snowden flew to the US mainland to attend training sessions at Booz Allen Hamilton's office near Fort Meade. His new salary was $122,000 (£74,000) a year, plus a housing allowance. On 4 April, he had dinner with his father. Lon Snowden says he found his son preoccupied and nursing a burden. "We hugged as we always do. He said: 'I love you, Dad.' I said: 'I love you, Ed.'"

"My position with Booz Allen Hamilton granted me access to lists of machines all over the world [that] the NSA hacked," Snowden told the South China Morning Post, adding that this was exactly why he'd accepted it. He was one of around 1,000 NSA "sysadmins" allowed to look at many parts of this system. (Other users with top-secret clearance weren't allowed to see all classified files.) He could open a file without leaving an electronic trace. He was, in the words of one intelligence source, a "ghost user", able to haunt the agency's hallowed places. He may also have used his administrator status to persuade others to entrust their login details to him.

Although we don't know exactly how he harvested the material, it appears Snowden downloaded NSA documents on to thumbnail drives. Thumb drives are forbidden to most staff, but a sysadmin could argue that he or she was repairing a corrupted user profile and needed a backup. Sitting back in Hawaii, Snowden could remotely reach into the NSA's servers. Most staff had already gone home for the night when he logged on, six time zones away. After four weeks in his new job, Snowden told his bosses at Booz that he was unwell. He wanted some time off and requested unpaid leave. When they checked back with him, he told them he had epilepsy (a condition that affects his mother).

And then, on 20 May, he vanished.

In December 2012, a reader pinged an email to Guardian columnist Glenn Greenwald, one of the more prominent US political commentators of his generation, based in Brazil. The email didn't stand out; he gets dozens of similar ones every day. The sender didn't identify himself. He (or it could have been a she) wrote: "I have some stuff you might be interested in."

"He was very vague," Greenwald recalls.

This mystery correspondent asked Greenwald to install PGP encryption software on his laptop. Once up and running, it guarantees privacy (the initials stand for Pretty Good Privacy) for an online chat. Greenwald had no objections. But there were two problems. "I'm basically technically illiterate," he admits. Greenwald also had a lingering sense that the kind of person who insisted on encryption might turn out to be slightly crazy.

Snowden going public for the first time in an interview that would become the most viewed story in the Guardian's history. Photograph: The Guardian

A month after first trying Greenwald and failing to get a response, Snowden tried a different route. At the end of January 2013, he sent an email to Greenwald's friend and collaborator Laura Poitras, a documentary film-maker. She was another leading critic of the US security state – and one of its more prominent victims. For six years, between 2006 and 2012, agents from the Department of Homeland Security detained Poitras each time she entered the US. They would interrogate her, confiscate laptops and mobile phones, and demand to know whom she had met. They would seize her camera and notebooks. Nothing incriminating was ever discovered. Poitras became an expert in encryption. She decided to edit her next film, her third in a trilogy about US security, from outside America, and moved temporarily to Berlin.

Snowden's email to Poitras read: "I am a senior member of the intelligence community. This won't be a waste of your time." (The claim was something of an exaggeration: he was a relatively junior infrastructure analyst.) Snowden asked for her encryption key. She gave it. "I felt pretty intrigued pretty quickly," Poitras says. "At that point, my thought was either it's legit or it's entrapment."

The tone of the emails was serious, though there were moments of humour. At one point Snowden advised Poitras to put her mobile in the freezer. "He's an amazing writer. His emails were good. Everything I got read like a thriller," she recalls.

Then Snowden delivered a bombshell. He said he had got hold of Presidential Policy Directive 20, a top-secret 18-page document issued in October 2012. It said that the agency was tapping fibre optic cables, intercepting telephone landing points and bugging on a global scale. And he could prove all of it. "I almost fainted," Poitras says. The source made it clear he wanted Greenwald on board.

Poitras moved ultra-cautiously. It was a fair assumption that the US embassy in Berlin had her under some form of surveillance. It would have to be a personal meeting. In late March, she returned to the US and met Greenwald in the lobby of his hotel, the Marriott in Yonkers. They agreed that they needed to get hold of the national security documents: without them, it would be difficult to rattle the doors on these issues.

Poitras had assumed that Snowden would seek to remain anonymous, but he told her: "I hope you will paint a target on my back and tell the world I did this on my own."

By late spring 2013, the possibility of a meeting was in the air. Snowden intended to leak one actual document. The file would reveal collaboration between the NSA and giant internet corporations under a secret program called Prism.

Poitras flew again to New York for what she imagined would be her meeting with a senior intelligence bureaucrat. The source then sent her an encrypted file. In it was the Prism PowerPoint, and a second document that came as a total surprise: "Your destination is Hong Kong." The next day, he told her his name for the first time.

Poitras knew that if she searched Snowden's name on Google, this would immediately alert the NSA. Attached was a map, a set of protocols for how they would meet, and a message: "This is who I am. This is what they will say about me. This is the information I have."

In mid-April, Greenwald received a FedEx parcel containing two thumb drives with a security kit allowing him to install a basic encrypted chat program. Snowden now contacted Greenwald himself. "I have been working with a friend of yours… We need to talk, urgently." The whistleblower finally had a direct, secure connection to the elusive writer. Snowden wrote: "Can you come to Hong Kong?"

The demand struck Greenwald as bizarre. His instinct was to do nothing. He contacted Snowden via chat. "I would like some more substantial idea why I'm going and why this is worthwhile for me?"

Over the next two hours, Snowden explained to Greenwald how to boot up the Tails system, one of the securest forms of communication. Snowden then wrote, with what can only be called understatement, "I'm going to send you a few documents."

Snowden's welcome package was around 20 documents from the NSA's inner sanctuaries, most stamped Top Secret. At a glance, it suggested the NSA had misled Congress about the nature of its domestic spying activities, and quite possibly lied. "It was unbelievable," Greenwald says. "It was enough to make me hyperventilate."

Two days later, on 31 May, Greenwald sat in the office of Janine Gibson, the Guardian US's editor in New York. He said a trip to Hong Kong would enable the Guardian to find out about the mysterious source. Stuart Millar, the deputy editor of Guardian US, joined the discussion. Both executives agreed that the only way to establish the source's credentials was to meet him in person. Greenwald would take the 16-hour flight to Hong Kong the next day. Independently, Poitras was coming along, too. But Gibson ordered a third member on to the team, the Guardian's veteran Washington correspondent Ewen MacAskill. The 61-year-old Scot and political reporter was experienced and professional. He was calm. Everybody liked him.

Except Poitras. She was exceedingly upset. As she saw it, an extra person might freak out the source, who was already on edge. "She was insistent that this would not happen," Greenwald says. "She completely flipped out." He tried to mediate, without success.

From left: the Guardian’s Ewen MacAskill and Glenn Greenwald, and documentary-maker Laura Poitras. Photograph: David Blishen for the Guardian

However, at JFK airport, the ill-matched trio boarded a Cathay Pacific flight. Poitras sat at the back of the plane. She was funding her own trip. Greenwald and MacAskill, their bills picked up by the Guardian, were farther up in Premium Economy. As flight CX831 took off, there was a feeling of liberation. Up in the air, there is no internet – or at least there wasn't in June 2013. Once the seatbelt signs were off, Poitras brought a present they were both eager to open: a USB stick. Snowden had securely delivered her a second cache of secret NSA documents. This latest data set was far bigger than the initial "welcome pack". It contained 3,000-4,000 items.

For the rest of the journey, Greenwald read the latest cache, mesmerised. Sleep was impossible: "I didn't take my eyes off the screen for a second. The adrenaline was so extreme." From time to time Poitras would come up from her seat in the rear and grin at Greenwald. "We would just cackle and giggle like schoolchildren. We were screaming and hugging and dancing with each other up and down," he says. Their celebrations woke up some of their neighbours; they didn't care.

The first rendezvous was in Kowloon's Mira hotel, a chic, modern edifice in the heart of the tourist district. Poitras and Greenwald were to meet Snowden in a quiet part of the hotel, next to a large plastic alligator. They would swap pre-agreed phrases. Snowden would carry a Rubik's cube.

Everything Greenwald knew about Snowden pointed in one direction: that he was a grizzled veteran of the intelligence community. "I thought he must be a pretty senior bureaucrat," Greenwald says. Probably 60-odd, wearing a blue blazer with shiny gold buttons, receding grey hair, sensible black shoes, spectacles, a club tie. Perhaps he was the CIA's station chief in Hong Kong.

The pair reached the alligator ahead of schedule. They sat down. They waited. Nothing happened. The source didn't show. Strange.

If the initial meeting failed, the plan was to return later the same morning. Greenwald and Poitras came back. They waited for a second time.

And then they saw him – a pale, spindle-limbed, nervous, preposterously young man. He was dressed in a white T-shirt and jeans. In his right hand was a scrambled Rubik's cube. Had there been a mistake?

The young man – if indeed he were the source – had sent encrypted instructions as to how the initial verification would proceed:

Greenwald: What time does the restaurant open?

The source: At noon. But don't go there, the food sucks…

Greenwald – nervous – said his lines, struggling to keep a straight face. Snowden then said simply, "Follow me." The three walked silently to the elevator. They rode to the first floor and followed the cube-man to room 1014. Optimistically, Greenwald speculated that he was the son of the source, or his personal assistant. If not, then the encounter was a waste of time, a hoax.

Over the course of the day, however, Snowden told his story. He had access to tens of thousands of documents taken from NSA and GCHQ's internal servers. Most were stamped Top Secret. Some were marked Top Secret Strap 1 – the British higher tier of super-classification for intercept material – or even Strap 2, which was almost as secret as you could get. No one – apart from a restricted circle of security officials – had ever seen documents of this kind before. What he was carrying, Snowden indicated, was the biggest intelligence leak in history.

Greenwald bombarded him with questions. His credibility was on the line. So was that of his editors at the Guardian. Yet if Snowden were genuine, at any moment a CIA Swat team could burst into the room, confiscate his laptops and drag him away.

As he gave his answers, they began to feel certain Snowden was no fake. And his reasons for becoming a whistleblower were cogent, too. The NSA could bug "anyone", from the president downwards, he said. In theory, the spy agency was supposed to collect only "signals intelligence" on foreign targets. In practice this was a joke, Snowden told Greenwald: it was already hoovering up metadata from millions of Americans. Phone records, email headers, subject lines, seized without acknowledgment or consent. From this you could construct a complete electronic narrative of an individual's life: their friends, lovers, joys, sorrows.

The NSA had secretly attached intercepts to the undersea fibre optic cables that ringed the world. This allowed them to read much of the globe's communications. Secret courts were compelling telecoms providers to hand over data. What's more, pretty much all of Silicon Valley was involved with the NSA, Snowden said – Google, Microsoft, Facebook, even Steve Jobs's Apple. The NSA claimed it had "direct access" to the tech giants' servers. It had even put secret back doors into online encryption software – used to make secure bank payments – weakening the system for everybody. The spy agencies had hijacked the internet. Snowden told Greenwald he didn't want to live in a world "where everything that I say, everything that I do, everyone I talk to, every expression of love or friendship is recorded".

Snowden agreed to meet MacAskill the next morning. The encounter went smoothly until the reporter produced his iPhone. He asked Snowden if he minded if he taped their interview, and perhaps took some photos? Snowden flung up his arms in alarm, as if prodded by an electric stick. "I might as well have invited the NSA into his bedroom," MacAskill says. The young technician explained that the spy agency was capable of turning a mobile phone into a microphone and tracking device; bringing it into the room was an elementary mistake. MacAskill dumped the phone.

Snowden's own precautions were remarkable. He piled pillows up against the door to stop anyone eavesdropping from outside in the corridor. When putting passwords into computers, he placed a big red hood over his head and laptop, so the passwords couldn't be picked up by hidden cameras. On the three occasions he left his room, Snowden put a glass of water behind the door next to a bit of tissue paper. The paper had a soy sauce mark with a distinctive pattern. If anyone entered the room, the water would fall on the paper and it would change the pattern.

MacAskill asked Snowden, almost as an afterthought, whether there was a UK role in this mass data collection. It didn't seem likely to him. MacAskill knew that GCHQ had a longstanding intelligence-sharing relationship with the US, but he was taken aback by Snowden's vehement response. "GCHQ is worse than the NSA," Snowden said. "It's even more intrusive."

The following day, Wednesday 5 June, Snowden was still in place at the Mira hotel. That was the good news. The bad news was that the NSA and the police had been to see his girlfriend, Lindsay Mills, back at their home in Hawaii. Snowden's absence from work had been noted, an automatic procedure when NSA staff do not turn up. Snowden agonised: "My family does not know what is happening. My primary fear is that they will come after my family, my friends, my partner." He admitted, "That keeps me up at night."

But the CIA hadn't found him yet. This was one of the more baffling aspects of the Snowden affair: why did the US authorities not close in on him earlier? Once they had spotted his absence, they might have pulled flight records showing he had fled to Hong Kong. There he was comparatively easy to trace. He had checked into the $330-a-night Mira hotel under his own name. He was even paying the bill with his personal credit card.

That evening, Greenwald rapidly drafted a story about Verizon, revealing how the NSA was secretly collecting all the records from this major US telecoms company. Greenwald would work on his laptop, then pass it to MacAskill. MacAskill would type on his computer and hand Greenwald his articles on a memory stick; the sticks flowed back and forth. Nothing went on email.

In New York, Gibson drew up a careful plan for the first story. It had three basic components: seek legal advice; work out a strategy for approaching the White House; get draft copy from the reporters in Hong Kong. She wrote a tentative schedule on a whiteboard. (It was later titled The Legend Of The Phoenix, a line from 2013's big summer hit, Daft Punk's Get Lucky.)

Events were moving at speed. MacAskill had tapped out a four-word text from Hong Kong: "The Guinness is good." This code phrase meant he was now convinced Snowden was genuine. Gibson decided to give the NSA a four-hour window to comment, so the agency had an opportunity to disavow the story. By British standards, the deadline was fair: long enough to make a few calls, agree a line. But for Washington, where journalist-administration relations sometimes resemble a country club, this was nothing short of outrageous. In London, the Guardian's editor-in-chief, Alan Rusbridger, headed for the airport for the next available New York flight.

Top guns (from left): Chris Inglis, the NSA’s deputy director; Robert S Litt, the general counsel to the Office of the Director of National Intelligence; Sean M Joyce, the FBI’s deputy director. Photograph: Getty (2); Reuters

The White House sent in its top guns for a conference call with the Guardian. The team included FBI deputy director Sean M Joyce, a Boston native with an action-man resumé – investigator against Colombian narcotics, counter-terrorism officer, legal attaché in Prague. Also patched in was Chris Inglis, the NSA's deputy director. He was a man who interacted with journalists so rarely, he was considered by many to be a mythical entity. Then there was Robert S Litt, the general counsel to the Office of the Director of National Intelligence. Litt was clever, likable, voluble, dramatic, lawyerly and prone to rhetorical flourishes. On the Guardian side were Gibson and Millar, sitting in Gibson's small office, with its cheap sofa and unimpressive view of Broadway.

By fielding heavyweights, the White House had perhaps reckoned it could flatter, and if necessary bully, the Guardian into delaying publication. Gibson explained that the editor-in-chief – in the air halfway across the Atlantic – was unavailable. She said: "I'm the final decision-maker." After 20 minutes, the White House was frustrated. The conversation was going in circles. Finally, one of the team could take no more. Losing his temper, he shouted, "You don't need to publish this! No serious news organisation would publish this!" Gibson replied, "With the greatest respect, we will take the decisions about what we publish."

Over in Hong Kong, Snowden and Greenwald were restless. Greenwald signalled that he was ready and willing to self-publish or take the scoop elsewhere if the Guardian hesitated. Time was running out. Snowden could be uncovered at any minute.

Just after 7pm, Guardian US went ahead and ran the story.

That evening, diggers arrived and tore up the sidewalk immediately in front of the Guardian's US office, a mysterious activity for a Wednesday night. With smooth efficiency, they replaced it. More diggers arrived outside Gibson's home in Brooklyn. Soon, every member of the Snowden team was able to recount similar unusual moments: "taxi drivers" who didn't know the way or the fare; "window cleaners" who lingered next to the editor's office. "Very quickly, we had to get better at spycraft," Gibson says.

Snowden now declared his intention to go public. Poitras recorded Greenwald interviewing him. She made a 12-minute film and got the video through to New York. In the Guardian US office, the record of Snowden actually speaking was cathartic. "We were completely blown away," Millar says. "We thought he was cool and plausible." When the moment arrived, with the video ready to go live, the atmosphere in the newsroom was deeply emotional.

Five people, including Rusbridger, were in the office. The video went up about 3pm local time on Sunday 9 June. "It was like a bomb going off," Rusbridger says. "There is a silent few seconds after a bomb explodes when nothing happens." The TV monitors were put on different channels; for almost an hour they carried prerecorded Sunday news. Then at 4pm the story erupted. Each network carried Snowden's image. It was 3am in Hong Kong when the video was posted online. It was the most-viewed story in the Guardian's history.

Snowden had just become the most hunted man on the planet. The chase was already on. Greenwald, in one of his many TV interviews, had been captioned by CNN as "Glenn Greenwald, Hong Kong" – a pretty big clue. The local Chinese media and international journalists now studied every frame of the video for clues. One enterprising hack used Twitter to identify the Mira from its lamps.

And then Snowden vanished.

• This article was amended on 17 February 2014 and further amended on 2 July 2014 to delete two paragraphs that referred to an "Estonian singer called Mel or Meelis Kaldalu".

• © Luke Harding 2014

This is an edited extract from The Snowden Files: The Inside Story Of The World's Most Wanted Man, by Luke Harding, published in the UK on Monday by Guardian Faber at £12.99; and in the US on 11 February by Vintage Books (excerpted by permission of Vintage, a division of Penguin Random House LLC. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher). To order a copy for £8.99, including free mainland UK p&p, call 0330 333 6846 or go to guardianbookshop.co.uk.

Watch the video of the day GCHQ came to the Guardian at theguardian.com/video.

In G2 on 3 February, what happened next: Edward Snowden in exile.