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

A newborn was found dead in a ditch in South Dakota 38 years ago, but the case went cold.

Then a detective picked up the case again 28 years after the crime.

"This case felt solvable, it always felt like we were so close," retired Sioux Falls Det. Michael Webb told NBC News on Monday.

And 10 years after Webb began working the case, the baby's mother was arrested Friday and faces murder charges.

The key was DNA and a searchable database that led to a match between the mother and the newborn.

"This was the first time in 38 years we would have anything close to this baby's identity," Webb said. "This was a unique case," he said, because investigators didn't know the identity of the baby boy or his family.

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

Webb discovered in 2009 that all testable evidence in the case had been destroyed in 1995. The only way to begin an investigation was by exhuming the infant's body and obtaining a DNA from the remains.

After the DNA profile was determined by researchers at the University of North Texas Health Science Center, Webb sent it to a state forensics lab, which tested it for matches in its DNA database.

When no matches were found, researchers tested the profile again once a year, with no luck.

That left Webb "extremely frustrated," he said, but he then turned to Parabon NanoLabs, a DNA technology company in Virginia that has helped with other cold cases around the country.

The lab found two possible genetic familial matches using GEDMatch.com, a free open-source website that allows people to upload their genetic information retrieved from genetic testing companies such as 23andMe and Ancestry to find other relatives or for research.

Last year, authorities in California were able to arrest the elusive Golden State Killer, Joseph James DeAngelo, 72, after using his familial DNA and running it through the same website. DeAngelo was at the time the suspect in 12 murders, 45 rapes and 120 burglaries throughout California in the 1970s and '80s.

Theresa Bentaas was charged in the death of a baby found in a ditch 38 years ago in South Dakota on March 8, 2019. Police used DNA and genealogy to determine she was the mother of the child, dubbed Baby Andrew. Minnehaha County Jail via AP

For Webb's probe, results from the open-source database together with old wedding and birth announcements allowed investigators to build "limited" family trees, eventually leading them to Theresa Bentaas — the baby's biological mother, who still after almost four decades lived in Sioux Falls.

"It's still a little crazy when I think about it," Webb said. "We did really put it together in a small period of time, considering we had absolutely nothing to go off of."

Police interviewed Bentaas, 57, on Feb. 27, which would have been the baby's 38th birthday.

She was arrested and faces charges of murder and manslaughter on March 8. Bentaas was due in court for an initial hearing in Minnehaha County, S.D., on Monday.

"We are now solving these sometimes decadeslong cold cases," Webb said. "DNA has come a long way and in law enforcement, these genealogy websites are now resourceful tools in our investigation."

Steven Armentrout, CEO of Parabon NanoLabs, said researchers are using DNA from the open-source site to solve almost one case a week.

"This is a way for investigators to be much more efficient and effective," he said.