CNN  — 

A gunman killed 26 people and wounded 20 others at a Texas church Sunday morning in what Gov. Greg Abbott called the largest mass shooting in state history.

At one point, the shooter tried to get a license to carry a gun in Texas but was denied by the state, Abbott said, citing the director of Texas’ Department of Public Safety.

“So how was it that he was able to get a gun? By all the facts that we seem to know, he was not supposed to have access to a gun,” Abbott told CNN. “So how did this happen?”

How the attack unfolded

Around 11:30 a.m. local time, a man dressed in all black exited a vehicle and started firing a rifle outside First Baptist Church in Sutherland Springs, a Texas community of a few hundred people about 30 miles east of San Antonio, the Texas Department of Public Safety said.

The gunman then entered the church, where services were underway, and continued to fire, officials said.

Eventually, as the gunman was leaving the church, a local resident who was armed with a rifle confronted the shooter, said Freeman Martin of the Texas Department of Public Safety.

Martin said there was an exchange of gunfire and the killer dropped his gun – a Ruger AR “assault-type rifle” – and sped away in a Ford Explorer. The armed resident, Stephen Willeford, hailed a man who was driving by and they pursued the shooter in a high-speed chase.

The gunman drove north into neighboring Guadalupe County, authorities said. Just across the county line, law enforcement officers found him dead inside his vehicle with gunshot wounds, Martin said.

Martin said an autopsy showed the shooter had three gunshot wounds: one in the leg and one in the torso from the armed citizen and a third in the head that “the medical examiner described as being consistent with being self-inflicted.”

The shooter and the investigation

The church attacker was identified as 26-year-old Devin Patrick Kelley of New Braunfels, Texas.

Martin said Kelley dressed in all-black “tactical-type gear” and was wearing a ballistic vest.

Kelley had been armed with two weapons, a rifle and a handgun, Wilson County Sheriff Joe Tackitt said. But the sheriff said he did not know if the handgun was used inside the church. Investigators found 15 empty magazines for the rifle, each capable of holding 30 rounds, inside the church, authorities said.

Investigators found indications in Kelley’s social media presence that he was interested in mass shootings, said a law enforcement official. Investigators pieced together from social media and interviews that Kelley had become increasingly obsessed over an unspecified family dispute.

Authorities said he sent threatening texts as recently as Sunday morning to his mother-in-law.

Kelley was a former member of the US Air Force. He served in logistics readiness at Holloman Air Force Base in New Mexico starting in 2010, according to Air Force spokeswoman Ann Stefanek.

Kelley was charged in military court in 2012 on suspicion of assaulting his spouse and their child, Stefanek said. Kelley received a bad conduct discharge, confinement for 12 months, and was demoted to E-1, or airman basic, she said.

The US Air Force acknowledged Kelley’s court martial conviction was not entered into the federal law enforcement database at the National Criminal Information Center, information that might have prevented gun sales to Kelley. Federal law prohibits people convicted of a misdemeanor crime involving domestic violence from owning firearms.

Kelley purchased the gun he used in the church shooting, a Ruger AR-556 rifle, in April 2016 from an Academy Sports + Outdoors store in San Antonio, a law enforcement official told CNN. He listed an address in Colorado Springs, Colorado, when he bought the rifle, the official said.

When Kelley filled out background-check paperwork at the store, he checked a box to indicate he didn’t have any disqualifying criminal history, the official said.

There was no disqualifying information in his background check, a law enforcement official told CNN.

The victims

Of the 26 who died, 23 were found dead inside the church. Two bodies were found outside. One person died after being transported to a hospital, Martin said.

Pastor Frank Pomeroy was out of town when the shooting occurred, but his daughter, 14-year-old Annabelle, was killed at the church, her mother Sherri Pomeroy said.

Texas shooting victim Annabelle Pomeroy

“We lost more than Belle yesterday, and the one thing that gives me a sliver of encouragement is the fact that Belle was surrounded by her church family that she loved fiercely and vice versa,” Sherri Pomeroy said.

Eight members of one family, including a pregnant woman and a 17-month-old girl, were among the dead. The eight included the visiting pastor, Bryan Holcombe, and members of his family, said Ron Scott, the visiting pastor’s first cousin.

The shooter’s grandmother-in-law, Lula White, also was killed.

Many of the victims have not been publicly identified, but family members have come forward with details and photos of their slain loved ones. The dead ranged in age from 17 months to 77 years old, Martin said.

About 20 people were taken to hospitals with injuries ranging from minor to severe, authorities said.

Reaction

President Donald Trump condemned the shooting as an “act of evil” and called it “horrific.”

The President, who was in Japan, said the shooting was caused by a “mental health problem,” not an issue with gun laws.

“Mental health is your problem here,” Trump said, noting that “based on preliminary reports” the shooter was “a very deranged individual.”

“This isn’t a guns situation,” Trump said. “This is a mental health problem at the highest level. It’s a very, very sad event.”

Abbott, Texas’ governor, said the state would mourn the dead and support their families. Vice President Mike Pence and his wife will visit Sutherland Springs on Wednesday.

“As governor, I ask for every mom and dad at home tonight, that you put your arm around your kid and give your kid a big hug, and let them know how much you love them,” Abbott said at a news conference Sunday evening.

CNN’s AnneClaire Stapleton, Dakin Andone, Ryan Browne, Evan Perez and Shimon Prokupecz contributed to this report.