STOCKHOLM, SWEDEN -- A 37-year-old man went on trial Tuesday for a double murder that went unsolved and gripped Sweden for more than 15 years until police matched his DNA on a popular genealogy website.

Daniel Nyqvist, who confessed to the crime shortly after his arrest last June, has been charged with the 2004 murder of a 56-year-old woman and an eight-year-old boy.

Both were stabbed in a random act one morning in the quiet southern Swedish town of Linkoping.

The crime shocked the nation with investigators unable to come up with either a perpetrator or a motive, despite finding the suspect's DNA at the scene, the murder weapon, a bloody cap and witness descriptions of a young man with blond hair.

Police even called upon the FBI for help, but to no avail. Over the years, the case file grew to become the second biggest in Sweden's history, after that of the 1986 murder of Prime Minister Olof Palme.

The case was finally cracked when new legislation in January 2019 allowed police to search for matches to suspects' DNA on commercial genealogy websites, which are popular among Swedes seeking long-lost relatives.

Investigators used the databases of Gedmatch and Family Tree.

"We received a match almost immediately. And several months later, the suspect could be arrested. His DNA was taken and matched 100 percent," police said in a statement the day after his arrest.

Nyqvist, whose brother was also briefly a suspect based on the DNA match, later confessed to the double murder.

Aged 21 at the time, he admitted to obsessive thoughts about killing and that he chose his victims randomly, first stabbing the boy and then the woman.

According to investigators, he had lived a secluded life near Linkoping since the murders.

An unemployed loner who liked to play computer games Nyquist seldom ventured out of his parents' house, media reports say.

Medical experts have concluded he suffers from a serious psychiatric disorder and did so at the time of the crime. If convicted, he will be sentenced to psychiatric care.