If the lone wolf suicide bomber, the killer-martyr, the high school shooter, the avenger of all the slights and snubs from a hostile world, had a generic face, it might look a bit like Anders Breivik’s: pudgy, piggy-eyed, with thin blond sweaty hair and a sickly smile. Breivik is the perfect example of what the German writer Hans Magnus Enzensberger once called “the radical loser”, the angry fantasist who wants to bring the world down with him.

Åsne Seierstad has written an exhaustive account of this wretched man’s murder in 2011 of 69 boys and girls in a summer camp for young socialists, and eight adults after a bomb attack in Oslo. It is a ghastly story of family dysfunction, professional and sexual failure, grotesque narcissism and the temptation of apocalyptic delusions.

A brilliant investigative reporter, Seierstad, best known for The Bookseller of Kabul, has based her book entirely on Breivik’s statements and writings, as well as police records and interviews with people involved in the murder spree, as victims or relatives of victims.

Breivik grew up in an expensive area in Oslo. But his home life must have been miserable from the start. He was still a baby when his parents got divorced. His father, a diplomat, disappeared more or less completely from his life. And his mother was a depressive, self-destructive woman who thought of sending her boy and his sister to an orphanage. They could “go to the devil”, as she put it to a child welfare officer.

Breivik was saved from this fate, but he appears to have been a needy child, who took his mother’s neglect out on others, weaker than himself, bullying his sister and tormenting pet animals. Attempts to join groups or make friends almost always ended in humiliation. He made up for his social failures by dreaming of personal grandeur. After latching on to a gang of graffiti artists, he pretended to be the top “tagger” in Oslo, and was swiftly rejected by his peers as a pathetic boaster.

Facebook Twitter Pinterest Anders Breivik in court in Oslo in 2012. Photograph: Corbis

He did have one childhood friend, called Ahmed, the son of Pakistani immigrants. Breivik admired the Pakistani street kids for being tough guys; he mimicked their street slang (“Kebab Norwegian”) and dress styles. Norwegian kids laughed at these pretensions; Ahmed moved away.

After finishing high school, Breivik tried various schemes to make quick money, such as selling advertising space by telephone, and failed. (He later succeeded for a while by peddling fake university diplomas on the internet, but this too ran into the sand when he was in danger of being exposed.)

At one point, joining the Freemasons seemed an attractive way to cut a figure in a secret society, but after being introduced to a lodge by a relative, Breivik got bored and never attended. This is when politics entered his life in the form of the Progress party, a populist outfit whose main agenda was to turn public opinion against immigrants, and the dangers of Islam. Breivik hoped to be picked as a candidate for city councillor.

He seems to have projected his own sense of helplessness on the imagined impotence of Norway, or Europe, or Christian civilisation, in the face of rampant “Islamisation”. His dreams of power became increasingly aggressive. He turned to guns, acquiring unusual expertise in weapons and military hardware. But Breivik was considered too weird even for the Progress party and he was never asked to run for office.

His love life, too, failed to take off. A mail-order bride was summoned from Belarus. Breivik’s mother seemed delighted. At last her son had found a girlfriend. But nothing came of this, either. Some who knew Breivik, who was always a fastidious dresser and liked to wear makeup, were convinced that he was secretly gay. He denied this fiercely and bragged that he was quite a brothel man.

Now that power, money and glory, had eluded him in real life, Breivik found temporary solace in virtual reality. Locked up in his room for days and nights, he became a warrior in a computer game called World of Warcraft. He called himself Andersnordic. In this virtual world, as Seierstad describes it, his “big body was dressed in a knight’s outfit with precious stones sewn on to the chest and huge epaulettes on the shoulders”. But even in this make-believe place of brave warriors and cataclysmic wars, Breivik remained an outsider. His peers in the gaming sphere found his delusions ridiculous and refused to accept him as a worthy player.

Facebook Twitter Pinterest Åsne Seierstad. Photograph: Elin Hoyland for the Guardian

Around 2006, he decided to go it alone. From then on, he lived almost entirely in his imagination, but his fantasies were still linked to the real world of politics and ideology. Breivik became obsessed with the idea that the west was at war with Islam. Inspired by websites, such as Robert Spencer’s Jihad Watch, or the Neo-Nazi Stormfront, books by the US journalist Bruce Bawer, speeches by the Dutch politician Geert Wilders, or a Norwegian blogger, named Fjordman, Breivik transformed himself into a character in cyberspace called Andrew Berwick.

As Berwick, he wrote a long manifesto entitled “2083: A European Declaration of Independence”, full of bellicose talk, cobbled together from his favourite websites, about the need to save western civilisation from being conquered by Islam.

In fact, however, Muslims were not the main targets of Berwick’s war, in which he dreamed of martyrdom and murder. The main enemies of Berwick’s Knights Templar, of which he himself was the “Justicious Knight Commander”, were “cultural Marxism”, “multiculturalism” and the “cultural elites” who collaborated with the “Islamisation” of the west.

To Breivik these were not just words: he had found a cause, a way to show his real power and get recognition at last from a cold and indifferent world. It was now time for some real action. The Knight Commander rented a remote farm, where he manufactured a powerful bomb. He also managed to acquire an arsenal of lethal weapons. And then came the bomb attack in the government district of Oslo, and the murder, with an exhilarated grin on the killer’s face, of young people gathered for the summer on a small island about 24 miles from the capital.

All this is described in chilling detail by Seierstad. What is striking is how much Breivik’s profile – the social and sexual failures, the sense of isolation, the conversion, often through the internet, to a grand and empowering cause – matches that of jihadi killers. Indeed, Breivik told his police interrogators that he was actually inspired by the fighting spirit of al-Qaida. But he is also like the murderers at Columbine high school, in Colorado, or the Boston bombers – the same lethal mixture of violent fantasy and feelings of worthlessness.

What such killers crave more than anything else is maximum publicity, fame, attention. This is true if they are loners. And it is true when they act as the suicidal hitmen for revolutionary groups. The sad irony is that politicians, journalists, bloggers, and a million commentators, including myself, invariably do everything to grant them their wish. Worldwide publicity transforms these misfits into heroic or villainous representatives of global religions, political ideologies and even entire civilisations.

Seierstad’s book, translated into English by Sarah Death, contributes to this phenomenon simply by being published. On the other hand, she does the opposite of making her subject look bigger than he is. In fact, she turns him back into the sad product of his time, his country, his culture, and his family. Her book is a psychiatric case history, as well as a close look at Norwegian society, not least by paying as much attention to Breivik’s victims, as to their murderer.

And yet, is it really good enough to see the killer only in terms of pathology? How far can we separate a Breivik from the ideas that inspired him? Muslims like to claim that jihadi terrorists have nothing to do with Islam. It is true that the Islamism promoted by Islamist revolutionaries is not what most Muslims believe in. But it is also true that elements of their faith are used to promote extreme violence. Islam cannot be blamed for this. But those who prod young people into committing murder by preaching hatred can be.

If this is so, then what about the ideas that inspired Breivik? To be sure, the likes of Spencer, Wilders or Bawer do not preach violent revolution. They never told anyone to kill a Muslim, let alone a “cultural Marxist”. But their talk of war, of a Muslim threat to our civilisation, “Eurabia” and of the complicity of cultural elites in our imminent downfall, does create a toxic climate in which fantasists such as Breivik can find a justification for their horrible deeds.

Breivik may or may not be a madman. The court psychiatrists in Oslo differed on this. In the end it was decided that he was not. But that ideas have consequences cannot be denied. This book throws a great deal of light on the life and times of a miserable killer. That he had a sick imagination is clear. More is to be said about the ideas that fed it.

• Ian Buruma’s Year Zero: The History of 1945 is published by Atlantic. To order One of Us for £13.59 go to bookshop.theguardian.com or call 0330 333 6846.