This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

To hear officials say it, Sutherland Springs shooter Devin Kelley should never have been able to buy a gun. He was court-martialed for assault on his wife and assault on their child while serving in the Air Force. He received a bad conduct discharge some time after. Now, the Air Force is acknowledging that the convictions were not properly transferred to the law enforcement database that would have allowed then to show up on an background check.

Because of this, and some particularities of Texas gun laws, Kelley was able to purchase the rifle he used in the shooting from a sporting goods store in San Antonio in April 2016.

Here’s a closer look at the laws surrounding owning and carrying a gun in Texas.

Texas has no assault weapons legislation

Like most states, Texas does not have an assault weapons ban in place. After the federal assault weapons ban expired in 2004, only seven states and the District of Columbia instated assault weapons bans, and two other states have regulations but not bans.

Kelley used a Ruger AR-556 rifle in his rampage. The AR-556 is a type of AR-15, a military-style rifle. Though definitions differ, it is usually considered an assault rifle, or an assault weapon, and is fully legal to purchase in Texas.

You need a license to carry a handgun on you, but not a long gun

In Texas, you do not need a permit to buy a handgun or a long gun. You also are not required to register firearms with the state, and you are not required to be licensed as an owner.

Texas has a very specific set of regulations on who can and cannot be licensed to carry a handgun.

According to the Texas Department of Public Safety, a person can be rendered ineligible for several reasons, including the conviction of a felony or Class A or Class B misdemeanor “or equivalent offense.”

According to Abbott, the Texas Department of Public Safety indicated Kelley applied for, and was denied, a license to carry a handgun. However, according to state laws, just because you do not have a license to carry a handgun does not mean you can’t purchase or possess one under federal law.

Kelley bought four weapons in total — two in Colorado and two in Texas, the ATF said. One each was purchased in 2014, 2015, 2016 and 2017. Two handguns were found in the shooter’s vehicle. A Ruger AR-556 rifle was found in front of the church where Kelley dropped it when a local resident rushed him.

While handgun licenses are a regulated part of Texas law, you do not need a license to carry a long gun, the gun that Kelley fired into the church. Moreover, there is no provision in the Texas Penal Code that prohibits carrying a long gun in public.

You do need to pass a background check

There is no waiting period for purchasing firearms in Texas, but you do need to pass a background check. In some states, a background check can be run fairly quickly through the National Instant Criminal Background Check System (NICS). However, Texas is not one of these states, so firearms dealers are required to contact the FBI directly for all firearm background checks.

The Gun Control Act prohibits the “transfer of a firearm” (which can be a sale) to people with certain criminal or personal history. Among the things that can keep you from getting a gun: A conviction of a crime “punishable by imprisonment for more than 1 year,” restraining orders pertaining to “an intimate partner or child,” a conviction of a “misdemeanor crime of domestic violence,” or a dishonorable discharge from the US Armed Forces.

This brings us back to the Air Force’s failure to notify civilian law enforcement of Kelley’s criminal record.

Kelley was court-martialed in 2012 for two counts of Article 128 of the Uniform Code of Military Justice.

This article states that anyone who “who attempts or offers with unlawful force or violence to do bodily harm to another person” is guilty of assault, and any person who “commits and assault” resulting or likely to result in death or serious injury is guilty of aggravated assault.

A US Air Force spokeswoman told CNN Kelley was punished under these provisions and received a “bad conduct discharge.” This discharge is different than a “dishonorable discharge,” which would have immediately prevented him from being sold a weapon under the Gun Control Act.

However, somehow the seriousness of the convictions never got relayed.

The Air Force acknowledged Monday evening that it did not appropriately relay Kelley’s court martial conviction for domestic assault to civilian law enforcement, preventing it from appearing in the federal database that licensed gun dealers are required to check before selling someone a firearm.

“Had his information been in the database, it should have prevented gun sales to Kelley,” the Air Force said.

In the statement, the Air Force says the Air Force Inspector General is currently conducting an investigation into what happened.

“Somebody really dropped the ball,” Former Air Force Chief prosecutor Colonel Don Christensen told CNN.

When trying to get a gun, applicants have to fill out ATF form 4473, a Firearms Transaction Record. Prospective buyers are asked, “Have you ever been discharged from the Armed Forces under dishonorable conditions?” Technically, for Kelley, they answer was no, since the military makes critical distinctions between other-than-honorable, bad conduct and dishonorable discharges.

The form also asks, “Have you ever been convicted in any court of a misdemeanor crime of domestic violence?”

A law enforcement official told CNN Kelley checked a box indicating he had no disqualifying criminal history when filling out the background check paperwork before his purchase. No disqualifying information showed up in the background check when it was completed, the official said.