The connection between the New Hampshire case, known as the “Bear Brook Murders,” and the Golden State case helps fill out the picture of how detectives were able to crack one of America’s most notorious and vexing serial murder cases after more than four decades of traditional police work led to one false lead after another. In January, investigators began piecing together genetic links between the suspect and users of the ancestry site GEDmatch, which had also been used in the New Hampshire case, and within four months had found their suspect.

Mr. Holes, it turned out, was linked to both cases. Years earlier, when he was already tracking the Golden State Killer, he had investigated a man for a murder in California who was later tied to the New Hampshire killings. He had since moved on to other cases, but last year Mr. Holes was briefed by a California detective, on a conference call, on how the New Hampshire case was solved, using ancestry websites and the help of genealogists. “I’m listening and I’m thinking, how can I use this technique in my other big case?” he said in an interview. “And that’s when I went on a deep dive with this technology.”

“It’s kind of weird how interconnected this thing was and how these things all came together,” he added.

After identifying distant relatives of the Golden State murder suspect in an online DNA database, Mr. Holes and other investigators spent months, working with genealogy consultants and using traditional police methods such as scouring death and census records, to build out about 25 family trees going back as far as the suspect’s great-great-great grandparents, who lived on the East Coast in the 1800s, according to Mr. Holes.

By scouring hundreds of names, the investigators narrowed in on a man living in a suburb of Sacramento, who matched physical descriptions of the suspect and, in his early 70s, was the right age. They decided to focus on the man, sent a surveillance team to retrieve an item the suspect discarded near his home, tested it for DNA and got a match with the killer’s genetic profile.