It was a caper that defied all logic.

The story of a man who raped children, murdered eight people, and cannibalized at least one of his victims, had appalled and captivated Sweden for two decades, and kept him locked away for as long. But on Wednesday, Sture Bergwall, who formerly went by the name of Thomas Quick, finally saw the light of day as a free man, with his confessions to those crimes discredited. It has left a whole country wondering how it could all have gone so wrong.

“It’s the judicial scandal of a century,” says Dan Josefsson, who was nominated to Sweden’s foremost non-fiction award Augustpriset for his book on Sture Bergwall, Mannen Som Slutade Ljuga (“The Man Who Stopped Lying,” to be published in English by Granta in 2015). “And it all has to do with a therapeutic idea that was in fashion in the nineties.”

Bergwall’s plan was born in 1991, when he was about to be released from Säter psychiatric ward, to which he was sentenced after a botched bank robbery. A long-time drug fiend, estranged from the outside world, Bergwall figured he’d be better off remaining in the clinic and started confessing to one murder after another.

“It’s fairly typical for a mixed-substance addict as Bergwall to lie to gain privileges,” says Josefsson. “He started telling the psychologists what they wanted to hear, and he was rewarded with drugs and encouragement.”

The therapeutic model that dominated the Säter facility at the time held that crimes could be inspired by repressed childhood memories. Allowed library access, Bergwall began reading up on famous, unsolved murders and claimed responsibility for them, fabricating justifications for those horrible deeds by citing repressed memories of sexual abuse as a child. He soon became the clinic’s star patient, reveling in the attention and comparing himself with Hannibal Lecter, Anthony Hopkins’ cannibalistic character in The Silence of the Lambs. Even worse, his so-called repressed memories were given enormous weight in the criminal investigations and trials that followed.

Bergwall frequently misstated details regarding the victims’ appearances, the murder weapons used and the sequence of events. Yet, those statements were taken as proof of his repression of painful memories, and Bergwall willingly played along. At one time, when asked why he said a victim had blonde hair instead of black, he replied that the agony of his recollections had made him reverse the colors as a kind of psychic self-defense.

“Police and prosecutors were completely into the idea too, even though it lacked scientific credibility,” says Josefsson. “It became a sect-like phenomenon where every piece of information was twisted to confirm their belief.”

Throughout the years, several commentators have published their doubts, but it wasn’t until 2009 that an appeal process was commenced. By that time, Bergwall had been convicted for eight of the more than thirty murders he had confessed to. However, he had also began to recover his mind, thanks to a doctor who began reducing Bergwall’s extremely high doses of medication. On Nov. 26, Bergwall was declared not guilty in the last of the eight cases, and will from Mar. 19 continue with an outpatient program at the clinic.

“The real victims in this systemic collapse are the relatives of the murdered,” says Josefsson. “They had to sit through the trials and listen to this man orate about the heinous things he supposedly did to their children – it’s practically psychological terror. At the same time, the real murderers have been able to breathe out.”

The Swedish government has appointed a commission to investigate what systemic failures led to this judicial catastrophe, although it won’t look into individual culpability. Bergwall, now 64, has said that he will write about his experiences at Säter. He already released a book in 2011, together with his brother Sten-Ove, called Thomas Quick is Dead.

Contact us at letters@time.com.