The remarkable way police found the Golden State Killer, thanks to his distant cousins.

For four decades police hunted for the Golden State Killer – but it was a distant relative’s seemingly small decision that finally led investigators to their man.

On Tuesday Joseph James DeAngelo Jr – the man police believe is responsible for 12 murders and 50 rapes between 1976 and 1986 – was arrested.

Now, California newspaper The Mercury News has reported that the breakthrough that led to the Sacramento man’s arrest were saliva samples on a genealogy website.

The potential arrest of a serial killer caught the world’s attention. Post continues.

Video by Mamamia

Unbeknownst to DeAngelo, his third and fourth cousins had used genealogy website GEDmatch to try to map their family tree. The distant relatives had sent in saliva samples to a service such as 23andMe and for DNA profiling, and had then shared that profile to GEDmatch to try to find relatives and trace their heritage.

This is important, because unlike and 23andMe, GEDmatch’s database of 900,000 DNA files is free and accessible to the public. For this reason, police do not require a court order to access this data.

Lead investigator Paul Holes used DNA collected from Golden State Killer’s crime scenes to search the database for a match, The Mercury News reports. When Holes was alerted to the partial DNA match with the cousins, detectives traced the family tree to find a man who would match descriptions of surviving victims.

It took years for police to determine the crimes were perpetrated by one person. Image: Sacramento Police Department

Based on the estimated age of the perpetrator victims gave in the 1970s and 80s, police knew they were looking for a man now aged in his 60s or 70s. DeAngelo was the right age and living in the area.

So police went to his home and collected "abandoned" items (which haven't been confirmed but may be a cigarette butt or tissue the 72-year-old had thrown away) to test his DNA against the killer's. Sure enough, DeAngelo was a match.

As Sacramento County District Attorney Ann Marie Schubert put it, "We found the needle in the haystack."

Schubert described finding the match as "astronomical" and a "holy s**t moment". Investigators have since said, to their knowledge this is the first time an ancestry website has been used to solve a cold case in this way.

DeAngelo has been charged with two counts of murder so far, but more charges may be added when the former police officer next appears in court.

If found guilty, DeAngelo would likely serve the rest of his life behind bars.