According to the affidavit, Mr. Leverett told the police that when he came home from the therapy group, “nobody was there, not even the dog, and he was lonely.”

“He stated that he wanted to go for a walk along the path near Iron Horse Boulevard in hopes of finding someone to talk with,” the affidavit continued.

Mr. Leverett said he was driving when he saw a woman jogging. He did not know her but was “attracted to her physical features” and decided to park his car and approach her, the affidavit said. He referred to Ms. Millan as “way out of my league,” the affidavit said, and became angry and “went into a frenzy.”

“Mr. Leverett claimed that he only wanted a chance to speak with her,” it continued, “but that ‘something happened’ and the next thing he knew he had stabbed her in the chest with a knife he was carrying.”

Mr. Leverett said that Ms. Millan fell onto the road and that he thought he heard her say, “Oh my God, oh my God, oh my God,” before he drove off in his car, according to the affidavit.

Mr. Leverett told the police that on the night of the murder, he had written letters confessing to the crime, though he never sent them. He also said that he had washed the blood from his clothes and tried to toss a pair of gloves into the rafters of a barn. One, he said, had gotten stuck there.

Last week, investigators found Mr. Leverett’s handwritten letters from 2014 — which referred to a “serious crime,” but not a murder specifically — and the glove in the barn, which was entered as evidence, the authorities said.