STOCKHOLM — Once considered Sweden’s worst serial killer, Sture Bergwall confessed to more than 30 murders over three decades, and was convicted of eight of them.

Years later, he changed his mind and said his ghastly tales of slaughter, rape and even cannibalism were all lies, spawned by loneliness, a desire for attention and heavy medication.

In what has become a major embarrassment for the Swedish justice system, Bergwall’s convictions are now being overturned one by one.

Courts that once found his chilling descriptions of the victims and the murder scenes enough proof to convict him now realize they may have been duped by a compulsive liar.

“This is the justice scandal of the century,” Bergwall, 62, told The Associated Press by telephone from a psychiatric hospital where he’s been held since 1991.

Five of his murder convictions have already been annulled. On Friday, a court in northern Sweden ordered retrials in the remaining two cases: the 1976 death of 15-year-old boy whose remains were found 17 years later, and the fatal stabbings of a Dutch couple in 1984.

New court proceedings may not even be necessary. When retrials were ordered in the other five cases, prosecutors dropped the charges, citing lack of evidence instead of going to court.

“This is the end of a four-year retrial process, but the start of a process to make him a free man,” Bergwall’s lawyer, Thomas Olsson, told AP after Friday’s ruling.

Bergwall grew up with six siblings in a Pentecostal home in Falun, 120 miles (200 kilometers) northwest of Stockholm. He said he developed an “identity crisis” after discovering he was gay and started taking drugs at age 14.

“There was no closet to come out of in those days,” Bergwall said. “That’s the reason for my drug problems and everything that came after.”

Bergwall said he never murdered anyone but molested three young boys in the late ’60s. After a bank robbery in 1990, he was found mentally unfit for prison and committed to a psychiatric hospital for the criminally insane. It was during therapy sessions there, Bergwall said, that he claimed responsibility for a series of unsolved murders going back to 1964.

“Simply put, I felt very lonely,” Bergwall told AP. “To make myself interesting I suggested that I had done something difficult. It aroused interest. I was given intense therapy and benzodiazepines.”

The sedatives only fuelled his morbid fantasies, said Bergwall, who at the time had changed his name to Thomas Quick.

During his trials, investigators said he gave information about the victims and the places where they were found or disappeared that he couldn’t have known unless he was there.

Bergwall said he got some information from newspapers while on leaves of absence from the hospital, but mostly embellished on details he had picked up from police interrogators.

“I didn’t know anything. That’s the simple truth. The information I got, I got through therapy and through police interrogations,” Bergwall said.

The eight murders for which he was tried and convicted had no apparent links. Three were in Norway, the others in different parts of Sweden.

The victims ranged from a 9-year-old Norwegian girl who disappeared in 1988 but whose body still hasn’t been found, to the Dutch tourists in their 30s who were stabbed in their tent while camping in the northern Lapland province.

Bergwall’s gruesome confessions — he claimed to have eaten some of his victims — made headlines in Swedish media in the 1990s. But there was also debate about the lack of technical evidence to support his convictions.

In a 2006 review of Bergwall’s case, Sweden’s chancellor of justice, Goran Lambertz, cleared Swedish authorities of wrongdoing. Lambertz, who is now a Supreme Court judge, said he still believes the convictions were correct.

“I’m not saying he is guilty, but the evidence was such that it was without doubt correct to convict him,” Lambertz said. He added that “there were a number of circumstances” indicating that Bergwall had been present” at the murder scenes.

For example, Bergwall had described the place where the 9-year-old Norwegian girl had disappeared with great detail, Lambertz said. He noted that Bergwall told police he had used a saw to dismember the girl, and a saw blade was found on the site.

Olsson, Bergwall’s lawyer, said his descriptions of places were not accurate on closer scrutiny.

“They did find a saw blade in the forest. But it didn’t look like (Bergwall) had described it,” Olsson said. “Keep in mind there is a large logging area in the vicinity.”

Olsson said that if his client is cleared in the remaining two cases, he could be released later this year.

Bergwall said he stuck to his confessions until he stopped taking benzodiazepines in 2001. He then entered what he described as a therapeutic period of silence, speaking to no one for seven years.

In 2008, he withdrew his confessions in a Swedish documentary, and started seeking retrials for his convictions. He said he now considers himself mentally fit to be released.

Bergwall said he felt bad for relatives of the murder victims, some of whose cases are now too old to reopen.

“There’s a lot left to explain,” Bergwall said. “And I will do that when the time is right.”