SUTHERLAND SPRINGS, Texas (Reuters) - A former U.S. serviceman who shot 26 worshipers to death during Sunday prayers in Texas was embroiled in a domestic dispute with his in-laws and had sent threatening text messages to his wife’s mother before the massacre, officials said Monday.

The Pentagon separately disclosed that it had failed to furnish information about the gunman’s criminal record from his U.S. Air Force service to a national database that should have prevented him from legally purchasing the firearms he bought.

The killer, Devin Kelley, 26, was convicted by court-martial of assaulting his first wife and step-son while serving in an Air Force logistics readiness unit and spent a year in detention before his bad-conduct discharge in 2014, according to the Pentagon.

The Air Force acknowledged on Monday that Kelley’s 2012 conviction on two counts of domestic violence were never entered into the National Criminal Information Center (NCIC) system, a U.S. government data bank used by licensed gun dealers for conducting background checks on firearms purchasers.

Federal law forbids anyone from selling or giving a gun to someone convicted of a crime involving domestic violence.

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.

Christopher Combs, special agent in charge of the Federal Bureau of Investigation’s San Antonio division, said there was nothing in the NCIC or two related databases that would have barred Kelley from legally buying any of three weapons police recovered from their investigation of the slayings.

Details of a 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 from a self-inflicted gunshot wound to the head 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 twice - in the leg and torso - by an armed area resident later identified as Stephen Willeford.

Still, Kelley managed to flee in a sport utility vehicle as Willeford waved down a passing motorist, Johnnie Langendorff, in a pickup truck. The two good Samaritans then chased after the suspect at high speeds, before the gunman’s vehicle crashed in a ditch, authorities said.

Freeman Martin, a spokesman for the state Department of Public Safety, hailed Willeford as “our Texas hero,” crediting him with preventing further carnage. Authorities said Kelley had called his father during the pursuit to say he had been shot and might not survive.

It appeared family problems may have been a factor in Sunday’s bloodshed. 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 Tackitt said the family members were not in the church during Kelley’s attack.

Martin put the number of victims killed in the attack at 26, including the unborn child of a pregnant woman who died. The dead otherwise ranged in age from 18 months to 77 years. Ten of the wounded in Texas remained in critical condition, officials said.

‘VIOLENT TENDENCIES’

Slideshow ( 23 images )

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.

The gunman walked up and down the church aisles shooting people on the ground in between the pews, according to an account related to CNN by David Brown, the son of one of the wounded survivors, 73-year-old Farida Brown, who was shot in both legs.

Brown said his mother told him the first shots came through the windows, then the assailant walked through the front door and started shooting, opening fire even at those diving on the floor for cover or attempting to flee.

Farida Brown was in the last pew, beside a woman who was shot multiple times, her son told CNN.

Slideshow ( 23 images )

“She was pretty certain she was next, and her life was about to end. Then somebody with a gun showed up at the front of the church, caught the shooter’s attention. He left and that was the end of the ordeal,” David Brown 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.

Martin said investigators found hundreds of spent shell casings inside the church after the church, as well as 15 30-round ammunition magazines, all of them empty.

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.

Vice President Mike Pence said on Twitter that he will travel to Sutherland Springs on Wednesday to meet with victims’ families and law enforcement.

“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.

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.”