It appears that the infamous Texas church shooter was able to buy firearms because of a crucial mistake on the Air Force’s part.

The Air Force acknowledged that the gunman, Devin Patrick Kelley, wouldn’t have been able to purchase a gun if the Air Force correctly submitted his criminal history to the FBI as required by military rules. Instead, they didn’t report his past incidents of domestic violence, according to Time Magazine.

New information reveals the gunman, who killed 26 people at a small-town church in Sutherland Springs, Texas by firing over 450 rounds into the helpless worshippers on Sunday morning, had a history of domestic violence stretching back for years.

Investigators revealed that Kelley sent threatening text messages to his mother-in-law before the attack and sheriff’s deputies responded to a domestic violence call back in 2014 at his home involving his girlfriend at the time.

Later that year, Kelley received a bad-conduct discharge for a 2012 assault on his ex-wife in which he choked her by the neck and hit her son hard enough to fracture his skull. There were also two charges of pointing a loaded firearm at his wife and two charges of pointing an unloaded firearm.

Although the firearm charges were dropped before the trial as a result of a plea agreement, Kelly did plead guilty to aggravated assault against the child and wife. Under Pentagon rules, information regarding convictions of military personnel for crimes such as assault need to be submitted to the FBI’s Criminal Justice Investigation Services Division.

“Initial information indicates that Kelley’s domestic violence offense was not entered into the National Criminal Information Center database by the Holloman Air Force Base Office of Special Investigations,” an Air Force statement said Monday.

“Learning that this senseless act of violence might have been prevented if only the proper form was filled out by military investigators was absolutely devastating,” said Sen. Kirsten Gillibrand (D-NY), according to The Washington Post.

Concerning this lapse in military protocol, Secretary of Defense James Mattis said Tuesday that he has directed the Pentagon’s Inspector General to investigate how this happened.

“If the problem is that we didn’t put something out, we’ll correct that,” he said. “There is at least an indication in what I’ve read in the press and what I’m getting through other elements of the government — not the Department of Defense — that the direction is out there. I’ve got to make sure. I don’t want to make assumptions right now.”

Former Army lawyer and professor Geoffrey Corn said that there is confusion between the Air Force and other military branches, in reporting only violent crimes that result in dishonorable discharges. Dishonorable discharges are a more severe punishment under martial law than the bad-conduct discharge that Kelley received.

The Texas church shooter wasn’t supposed to be able to get a gun. Would more gun control have stopped him?

“Either the Department of Defense is reporting these convictions, or they’re not,” Mr. Corn said. “How is the federal statute going to be effectively implemented if they aren’t reporting these convictions?”

The thought that this massacre could have been avoided by following proper military procedure is one that many Americans will find shocking. In the end, rectifying this problem will not bring the lives lost back. However, the hope is that it could dissuade a similar situation from occurring again.