Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Detectives hunting for the Golden State Killer got their man after climbing up and down dozens of online family trees in search of somebody who fit his profile and could be a DNA match, authorities told NBC News on Thursday.

The Sacramento investigators narrowed down their search to a 72-year-old former police officer named Joseph James DeAngelo after looking at the profiles that people exploring their family backgrounds posted on various websites that specialize in those kinds of searches, they said.

Six days after they zeroed in on DeAngelo, who lived in a Sacramento suburb, they slapped handcuffs on the man they believed terrorized California from 1974 to 1986 — a 12-year reign of terror during which a dozen people were killed, 45 women were raped, and more than 100 homes were burglarized.

DeAngelo was arrested on a warrant out of Ventura County in the murders of two people and is expected to make his first court appearance on Friday.

In announcing his arrest, police gave few details about how they captured DeAngelo, saying only that he had been under surveillance for six days and that they used "discarded DNA" to track him down.

"This was a true convergence of emerging technology and dogged determination by detectives," Sacramento County Sheriff Scott Jones said on Wednesday. "In this case justice was delayed. It wasn't swift but it will be sure."

Chief Deputy District Attorney Steve Grippi shed new light Thursday on how DeAngelo was captured, confirming a report in the Sacramento Bee.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

DNA from crime scenes was used to create a genetic profile, which was then matched with profiles available online from a commercial genealogy company.

Grippi said detectives followed clues to individuals in the family trees to determine whether they were potential suspects. They found distant relatives of DeAngelo's, and traced their DNA back to him.

Then, last week, after they settled on DeAngelo by looking at his age and where he had lived in California while the mysterious killer was sowing mayhem, they went to his home in Citrus Heights and obtained "his DNA from something he discarded," the paper reported.

It did not specify what it was.

Then they took that DNA sample and compared it with a DNA sample that had been taken from a crime scene many years ago.

When the crime lab confirmed the match on Monday, excited investigators began hatching a plan to arrest DeAngelo.