In September, photos of naked celebrities were hacked and then posted on the image-sharing website 4chan, to the shock and surprise of much of the world’s media. Gabriella Coleman would not have been surprised. On 4chan, posting nudes of strangers and celebrities happens almost every day: and this exciting, dreadful, raucous website provides the opening scene for her long-awaited story of the hacktivist collective Anonymous. The movement evolved, from a loose collective of teenaged 4channers posting porn, into one of the most interesting and unusual groups of our time, terrifying businesses, governments and individuals with their hacking and programming skills.

Coleman, who accidentally stumbled into 4chan while studying Scientology, expertly guides the reader through this surprising evolution. The story of Anonymous begins with members of 4chan getting dragged into an online fight with Scientologists, who had been trying to prevent people from sharing a bizarre video of its most famous adherent, Tom Cruise, online. The 4channers were emboldened by success and shifted to politics, attacking the PayPal website for refusing to accept donations for the whistleblowing website WikiLeaks. The book really comes alive in early 2011, when these activists (“anons”), having adopted their name, turned their gaze to Tunisia, alerting an initially indifferent media to the revolution and exposing the corrupt Tunisian government, before lending support to the worldwide Occupy movement. Coleman is in the thick of it throughout, watching the group’s activity subsequently fracture into more militant and random attacks against businesses and governments, and as the FBI and other police forces start to prosecute several of its main protagonists.

Anyone interested in Anonymous, or the shape of protest in the age of the internet, will find abundant new details and smart insight here. Coleman has enjoyed unique access to the shadowy group’s inner workings, its core members and its secretive chat rooms. For all the computer wizardry, it is still a real movement of real people.

Yet she is often too present in her story, and the result is unnecessary detail (“I felt OK, but a little tired – certainly under-caffeinated”) or self-admiration. Coleman, who used the pseudonym Biella, quotes anons talking about her: “I don’t think she realises how much she’s contributed to Anonymous.” Later she documents a demonstration she attended, where “on seeing me, a pair of [anons] nodded. One gave me a thumbs up and told me to ‘keep up the good work’.”

She is not quite Margaret Mead in Samoa, but at times her chats with anons on internet relay channels (used by anons to communicate) give the strong impression she’d rather like to be a hacktivist herself. Her language throughout betrays her loyalties. Anonymous’s announcement declaring war on Scientology is “poetic and inspirational”; its members are “contemporary trickster figures” who wear a mask that “functions as a eternal beacon, broadcasting the value of equality”. She admits to being so angry with Sabu – the Anonymous snitch recruited by the FBI – that “it took a month before my anger receded enough” for her to talk to him again.

She amply demonstrates that Anonymous have done much that is admirable, and that the group is far more complex than the press caricature of basement-dwelling criminals. They tend to fight for things most of us support: privacy online, freedom of expression, government transparency. But too little attention is given to the way they trample over others to get there. One of their early targets was Hal Turner, a neo-Nazi. Repellent – but is it okay for a vigilante mob to relentlessly attack him? Members of the radical, ballsy offshoot of Anonymous, Lulzsec, hacked media outlets because they didn’t like a TV show; went after the NHS; hacked a Skype call between the FBI, Metropolitian police and the Garda; leaked the email messages, names, phone numbers, home addresses and passwords belonging to Arizona police officers; defaced the website of the centre-right Irish political party Fine Gael; and uploaded thousands of email addresses of innocent people. Coleman doesn’t denounce this, preferring to stress that Lulzsec “demonstrated the importance of art, expression, autonomy, and creation through unalienated labour”. She includes a thoughtful and much-needed discussion of Distributed Denial of Service (DDoS ) – a way to bring down a website – as a form of legitimate political protest, but she thinks it is hypocritical for the British spy agency GCHQ to use a DDoS, while arresting Anonymous activists who do the same. “The law”, she writes, “is not equally applied.” But then governments often do things that citizens cannot.

Coleman does well to avoid the jargon and technical language that often characterises books about the net, although her account lacks the journalistic fizz of Parmy Olson’s We Are Anonymous (2012), and includes awkward turns of phrase. There is a clunky description of Anonymous as “meshed together by wires, transistors, and Wi-Fi signals – replete with miles of tubes pumping blood … the analogue of these fabulously grotesque and chaotically precise systems that, if picked apart, become what we call people”. And she makes the peculiar suggestion that “members of the public discovered their jaws dropping lower and lower by the day, as if they were strapped into some orthodontic-transparency device, hand cranked by Julian Assange himself”.

For all that, this is a worthwhile and enjoyable examination of an often mysterious group, written by a genuine expert. In the end Coleman succeeds in her chief aim: to show that Anonymous are neither criminals nor bored teenagers, but are driven on the whole by political motivations which are for the most part thoughtful, considered and courageous. She reveals the group to be far more interesting and morally nuanced than is often believed, using digital tools and tactics to tilt rights and freedoms away from companies and governments and towards people.

For much of 2014, Anonymous seemed to have gone quiet. But, as Coleman’s book demonstrates, it is a reactive, unpredictable and dynamic movement. Last week, it surged back into action: after the Ku Klux Klan threatened to use lethal force in Ferguson, Missouri following riots there, Anonymous declared cyber war on the group. They hacked the KKK’s Twitter account and attacked servers that hosted its sites; they even started to release the personal details of KKK members. As usual, it was part joke, part principled; part justified, part irresponsible. A movement for our times.

• Jamie Bartlett is the author of The Dark Net, published by William Heinemann. To order Hacker, Hoaxer, Whistleblower, Spy for £12.99 (RRP £16.99) go to bookshop.theguardian.com or call 0330 333 6846.