It is perhaps a little hard to remember now, but in 2010, there seemed to be a new global superpower. A superpower that acted in unorthodox ways, which was unaccountable and yet of the people, and that was above all nameless, faceless and, as it styled itself, Anonymous.

Born of the internet, it acted most decisively and effectively when it was the internet itself that was threatened. One of its earliest, most successful operations came a matter of days after WikiLeaks published the embassy cables and found its source of funding cut off after PayPal, Visa and Mastercard refused to take donations on its behalf.

Parmy Olson, an Anglo-American reporter with Forbes and the author of We Are Anonymous, describes what happens next. Up until that point, Anonymous was a "brand of internet users known for pranking restaurant managers, harassing paedophiles and protesting the Church of Scientology", but the attacks on WikiLeaks turned it political.

Hundreds of people flooded its chatrooms and its operators directed them to download a piece of software that they could use to "DDoS" (or "denial-of-service attack") PayPal's website: effectively flood it with traffic and render it useless, or as they put it: "HOW TO JOIN THE FUCKING HIVE."

For an insight into what actually was going on, who was masterminding the attacks and how the "hive" actually worked, Olson's book is a truly terrific read. From a mass of confusing detail, she's created a clear, coherent narrative that traces Anonymous's origins to the 4Chan website and painstakingly details the chronology of its evolution. (Not that the confusion goes away. As she points out: "The media, police and even the hackers themselves had their own concepts of what it really was: an idea, a movement, a criminal organisation and other things besides.")

But it is with the emergence of a splinter faction, LulzSec, that the book really comes alive. LulzSec, a small band of talented hackers and activists, were, for a time, the most wanted cyber-criminals on the planet. They hacked the CIA and Soca, the UK's Serious Organised Crime Agency. After PBS aired a programme that they perceived as critical of WikiLeaks, they hacked into its server and posted a story on its website claiming that Tupac Shakur had been found alive and well "and living in New Zealand". They took down the Sun's front page and replaced it with another claiming that Rupert Murdoch had died in "his famous topiary garden".

And Olson has a ringside seat. While the world was still baffled by LulzSec's exploits, and the police and security services on at least two continents were trying to find them, Olson befriended one of the key members of the group, Topiary, the author of the Sun news report, a teenager living far away from the centres of power he was helping to hack – Shetland.

She is there watching the saga unfold, talking to other members of the group, including Sabu, the ringleader, while they choose their next targets and revel in the "lulz", the sheer anarchic joy of bringing global corporations such as Sony to their knees. Because humour, as well as power, was a key to LulzSec's operations. It was part of Anonymous culture, Olson writes, to make up "random, outrageous statements" (this was a particular problem, she was to find, when it came to finding out the truth of what actually happened, though she explains in one of her many meticulous footnotes, that she always tried to corroborate any statement independently). "If, for instance, someone was about to leave his or her computer for a few minutes to get coffee, he or she might say, 'Brb, FBI at the door.'"

And then the FBI was at the door. Sabu was picked up by the feds, held for 24 hours, turned into an informer and then dropped back into position. And it was only a matter of time before the arrests began, including those of Topiary, Ryan Cleary, an autistic teenager from Essex, Ryan Ackroyd, a 26-year-old ex-soldier from Doncaster who purported to be a 16-year-old girl, and T-flow, or Mustafa Al-Bassam, from south London, who really had been 16 at the time and whose hacking CV included writing a script that helped Tunisian revolutionaries overcome government internet restrictions.

It is a fascinating tale, and if there is an element of luck to Olson having such great access it is the kind of luck you have to work like a dog to win, because this may be a tale about the reach and power of new technology, but it is backed up by old-fashioned investigative reporting. Olson's research is properly impressive.

Which is why it is a shame there is not more of her in the book. When I interviewed her for a piece I wrote on Anonymous last year, she described how she'd flown up to Shetland to meet Topiary while the world was still clueless as to his identity and it is such a great detective thriller that it's a shame that there's not more about the investigative process itself, though it is to Olson's credit that her modesty and sense of journalistic decorum prevented that.

In fact, the book has only one substantive flaw and it's one that is plainly not Olson's fault: it's out of date. I first read the American edition when it was published last year but owing to legal issues surrounding the trials, Olson's UK publishers, William Heinemann, delayed its publication a whole year, but bafflingly gave Olson a deadline that was February at the latest, which means there are no updates on the British trials or sentencing, not much on the huge disparity between the sentencing of the main actors in the US, the UK and Ireland, and nothing at all on the significance of the Snowden leak and the NSA.

Here is the biggest takeaway: if you're going to be a hacker, kids, get the hell out of America. Jake Davis, aka Topiary, has now served his sentence and is free, whereas Jeremy Hammond, who has pleaded guilty to hacking into Stratfor, a private intelligence agency working for the US government, is potentially facing a 10-year sentence and possible multimillion-dollar fine. But then the battle of the internet versus the nation state is only just beginning.

• Editor's note: this article originally confused the journalist Barrett Brown with hacker Jeremy Hammond in the final paragraph, and misstated that Brown had pleaded guilty to hacking charges; Brown is currently in jail in Texas facing federal charges related to his investigations of intelligence contractors, but has entered no plea. Hammond has admitted his role in hacking Stratfor. The article was amended at 5pm (UK) on 18 August