The killer, Devin Kelley, 26, was previously convicted by court-martial of assaulting his first wife and step-son while serving in the U.S. Air Force and spent a year in detention before his bad-conduct discharge in 2014, according to the Pentagon.
The Air Force acknowledged on Monday that it failed to enter Kelley's 2012 domestic violence offense into a U.S. government database used by licensed gun dealers for conducting background checks on firearms purchasers.
A sporting goods retail chain has said Kelley passed background checks when he bought a gun in 2016 and a second firearm the following year.
Details about Kelley's background of violent, disturbing behavior emerged a day after Sunday's rampage in southeastern Texas, which ranks as the deadliest mass shooting by a lone gunman in the state and one of the five most lethal in modern U.S. history.
Kelley was found dead, apparently of gunshot wounds, after a failed attempt to make his getaway from the First Baptist Church in Sutherland Springs, Texas, authorities said.
Stepping out of the church, Kelley was confronted and shot three times by an armed area resident. Kelley then fled in a sport utility vehicle as the resident waved down a passing motorist. The two good Samaritans then chased after the suspect at high speeds, authorities said.
Freeman Martin, a spokesman for the state Department of Public Safety, credited the man who shot Kelley as "our Texas hero."
Kelley called his father during the pursuit to say he had been shot and might not survive, officials said. He later crashed his vehicle, shot himself and died, they added. It was not clear if he died of the self-inflicted wound or those sustained in the gunfight, officials said.
It appeared that family problems may have been a factor in Sunday's carnage. Kelley was involved in a domestic dispute with the family of Danielle Shields, a woman he married in 2014, and the situation had flared up, according to officials and public records.
"There was a domestic situation going on within the family and the in-laws," Martin told reporters outside the church on Monday. "The mother-in-law attended the church ... she had received threatening text messages from him."
Wilson County Sheriff Joe Tacit said the family members were not in the church during Kelley's attack.
Kelley himself had attended services at the church at times, U.S. Senator Ted Cruz of Texas told reporters at the scene.
"My understanding is that this depraved madman had worshipped at this church before," Cruz said.
The attack came about a month after a gunman killed 58 people in Las Vegas in the deadliest shooting by a lone assailant in modern U.S. history.
The dead in Sunday's bloodshed ranged in age from 18 months to 77 years.
Wearing a black bullet-proof vest and skull mask, Kelley used a Ruder AR-556 semi-automatic rifle in the attack, authorities said. They recovered two other weapons, both handguns, from his vehicle.
In rural Texas and in other states, gun ownership is a part of life, and Republican leaders for years have balked at gun control measures, arguing that responsible gun owners can help deter crime.
Republican Texas Governor Greg Abbott told CBS News there was evidence that Kelley had mental health problems and had been denied a state gun permit.
"It's clear this is a person who had violent tendencies, who had some challenges," Abbott said.
Abbott and other Republican politicians said the mass shooting did not influence their support of gun ownership by U.S. citizens - the right to bear arms protected under the Second Amendment of the U.S. Constitution.
"This isn't a guns situation. I mean we could go into it but it's a little bit soon," U.S. President Donald Trump told reporters while on a trip to Asia. "Fortunately somebody else had a gun that was shooting in the opposite direction, otherwise ... it would have been much worse."
Democrats renewed their call to restrict gun ownership.
"How many more people must die at churches or concerts or schools before we stop letting the @NRA control this country's gun policies," Democratic U.S. Senator Elizabeth Warren said on Twitter, referring to the powerful gun lobby the National Rifle Association.
Vice President Mike Pence said on Twitter that he will travel to Sutherland Springs on Wednesday to meet with victims' families and law enforcement.
The attack stunned Sutherland Springs, a community of about 400 people with just one blinking yellow traffic light. One family, the Holcombe, lost eight people from three generations in the attack, including Bryan Holcombe, an assistant pastor who was leading the service, a relative said.
John Stiles, a 76-year-old retired U.S. Navy veteran, said he heard the shots from his home about 150 yards (137 m) away: "My wife and I were looking for a peaceful and quiet place when we moved here but now that hasn't worked out."
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)