The daylight rape was as shocking as it was brazen. A 19-year-old woman, walking alone in the pastoral Norristown Farm Park, had a gun pressed to her head in the waning days of summer 2017 and was pulled into a secluded wooded area.

And for two years, Montgomery County District Attorney Kevin R. Steele had obsessed over the case. He and his staff, Steele said Monday, began to “think outside the box.” They posted a $10,000 reward. They consulted with prosecutors in California who caught the “Golden State Killer.” And they submitted their only clue, the attacker’s DNA, to strenuous testing at a lab.

Finally, on Friday, they arrested the man they believe was responsible for the crime: Mason Alexander Hall, a 19-year-old who lives a little over a mile from the park.

“He faces these charges because we took every possible step we could to get a violent predator off the streets," Steele said Monday in announcing Hall’s arrest.

Hall has been charged with involuntary deviate sexual intercourse, sexual assault, terroristic threats, reckless endangerment, and related offenses. Investigators said Hall, then 17, sneaked up behind the woman as she was on her daily walk and threatened to shoot her if she stopped walking.

He remained in custody Monday with bail set at $1 million, and there is no indication he had hired an attorney. Hall faces a preliminary hearing on Oct. 30.

His arrest came at the end of “thousands of hours” of manpower, Steele said, a hunt that combined modern DNA research with traditional investigative work.

“We always knew who committed this assault. ... We just didn’t know his name,” Steele said. “We do now.”

The key break in the case came from a genetic profile created for investigators by Parabon NanoLabs, a scientific laboratory in Virginia, using DNA left behind after the assault.

With that profile, investigators began to essentially work backward, looking for the then-unidentified suspect’s family members in publicly available databases. They found some local matches, and after interviewing them, developed two suspects, according to Steele.

One of them was Hall, who detectives later discovered had been arrested in Norristown a month after the rape was reported, according to the affidavit of probable cause for his arrest. In that case, the teen was arrested for allegedly vandalizing a car with a hammer.

The instrument, stained with Hall’s blood after he cut his hand on the auto glass, was still in evidence, the affidavit said. With help from Philadelphia police, county detectives in September compared the blood with the DNA from the park.

It was a match. Hall was taken into custody at his home late last week after trying to flee from police, Steele said.