Federal law lists 11 criteria that would bar someone from buying a gun, including two that would seem to apply to Mr. Kelley: conviction of a crime punishable by more than a year in prison — assaulting his stepson, which carried a maximum sentence of five years — and conviction of a domestic violence misdemeanor.

The Department of Defense has reported only one domestic violence case to the federal database for gun purchase background checks, records show. It has reported 11,000 service members to the database, but almost all of them were because of dishonorable discharges, which prohibit gun purchases. Mr. Kelley, after serving 12 months in a Navy brig in California, received a “bad conduct” discharge, which is not by itself an automatic bar to gun purchases.

Elise Hasbrook, a spokeswoman for Academy Sports + Outdoors, which owns two San Antonio shops that each sold Mr. Kelley a gun in the last two years, said “both sales were approved by the National Instant Criminal Background Check System.” Mr. Kelley had bought two other guns since his court-martial, both in Colorado, the authorities said.



Gov. Greg Abbott of Texas told CNN that Mr. Kelley had been rejected when he applied for a license to carry a handgun in Texas. State officials did not specify why he was rejected, and a carrying license is not required to purchase a firearm from a gun shop so long as the buyer passes the federal background check.

“By all the facts that we seem to know, he was not supposed to have access to a gun, so how did this happen?” Mr. Abbott said.

The authorities in Comal County, which includes Mr. Kelley’s hometown, New Braunfels, also released records on Monday that showed Mr. Kelley had been the subject of an investigation for sexual assault and rape by force in 2013. The investigation ended without the filing of any charges.

On Monday, Sheriff Tackitt of Wilson County, where First Baptist is located, described Mr. Kelley’s horrific and methodical path through the church. After firing from outside the building, Mr. Kelley entered the church, and fired his weapon from side to side as he paced through the room, the sheriff said. Among those killed were members of three generations of the Holcombe family, including the guest preacher and his wife, and an 18-month-old girl named Noah.

“There was nothing anyone could do until he came out,” Sheriff Tackitt said.

After Mr. Kelley stepped out of the church, a man outside was waiting with his own rifle. They fired at each other, and Mr. Kelley was hit twice. He then drove off in his car.

The bystander, who identified himself Monday night as Stephen Willeford, flagged down a nearby driver, Johnnie Langendorff, and they gave chase, at speeds upward of 90 miles an hour, Mr. Langendorff said. Mr. Kelley contacted his father from his cellphone during the chase to tell him that he had been shot, according to law enforcement officials, telling his father that he “didn’t think he was going to make it.” He soon crashed and was found dead behind the wheel with three gunshot wounds, including his own shot to his head.

Sheriff Tackitt called Mr. Willeford a “hero.”

In an interview with a local television station, Mr. Willeford said his daughter had heard gunshots from the church and alerted him. He retrieved his rifle and went to the church.

Mr. Willeford grew emotional as he spoke about what he saw and heard.

“Every time I heard a shot I knew that probably represented a life,” he said. “I was scared to death, I was. I was scared for me and I was scared for every one of them. And I was scared for my own family that lived less than a block away.”

“I’m no hero, I am not,” he said. “I think my God, my Lord protected me and gave me the skills to do what needed to be done.”

“I just wish I could have gotten there faster,” he said.