It is a story worthy of Sweden's finest crime writers. A serial killer who cuts up and eats more than 30 people in the country's worst murder spree, earning a reputation as the country's very own Hannibal Lecter.

Under interrogation by police investigators a suspect confesses to the crimes, saying he maimed and raped his victims and ate their remains. The youngest victims was a nine-year-old girl whose body was never found.

In a series of trials starting in 1994, the killer is convicted of eight murders and locked up indefinitely in an institution for the criminally insane.

But two decades later it emerged that the man, Sture Bergwall, was not a murderer after all. Rather he made up his confessions after being drugged by incompetent investigators only too eager to close their cases.

On Wednesday the last of those murder convictions was overturned when Bergwall was acquitted of the murder and dismemberment of a schoolboy 37 years ago.

"That a person has been convicted of eight murders and later been declared innocent, that is unique in Swedish legal history," prosecutor general Anders Perklev said after the acquittal. "It must be judged as a failure for the justice system."

There had been no forensic or other evidence against Bergwall, his conviction relying solely on his confession, Perklev said. The confession, it emerged after years of painstaking work by investigative journalists, was coaxed out of Bergwall – then calling himself Thomas Quick – while he was in a psychiatric hospital and taking enormous quantities of benzodiazepines.

Justice minister Beatrice Ask immediately announced a full review. "This is basically about seeing how it could go so wrong," she told Swedish daily Svenska Dagbladet. Bergwall's lawyer, Thomas Olsson, said: "It is a big scandal and a failure of the system, but also a victory: the Swedish legal system has shown it has the strength and integrity to admit its mistakes and correct them."

In a further breakthrough for Bergwall earlier this week, a court granted his request for an independent assessment of his mental state. He could be free in two to four months, Olsson said.

In the meantime Bergwall will remain in Säter psychiatric hospital, his home for the past 22 years. He has been free from medication since 2002, Olsson said.

Björn Asplund's 11-year-old son, Johan, disappeared in 1980. Bergwall later claimed to have raped, strangled and dismembered him. "This is what we have struggled with ever since the first day Thomas Quick entered the scene – I never believed he was responsible for my boy's death or any of the murders," Asplund said on Wednesday.

"The real killers are roaming free in our society because of the travelling circus surrounding Thomas Quick."

Johan disappeared so long ago that the statute of limitations on his case has expired, so there will be no new investigation and no prospect of a conviction.

"No one will ever go to court for the death of my son, but I want to see the justice minister or the prime minister step forward and apologise to all the relatives of victims who have suffered so long and been so badly treated by the Swedish justice system," Asplund said.

Journalist Jenny Küttim worked for three years with the late documentary maker Hannes Råstam to expose the miscarriage of justice. While delighted at the verdict, which fully vindicates Råstam's work, she is also bitter.

"It means that you can get away with anything because nobody will be held responsible, and that's terrible," Küttim said, calling for an independent review to scrutinise the psychiatric ward where Bergwall was held, the police, and the prosecutors involved in the murder investigations.

"Otherwise we can never learn from the history of this crime."

Now 63, Bergwall wrote on his blog that it was "a day of joy and a day of reflection". He has retracted all his confessions.