(AP) -- Devin Kelley, who carried out the massacre at a Texas church, was able to buy four guns even though he had been convicted in the Air Force of domestic violence. Yet he was denied a Texas permit to carry a firearm. Here's a look at some of the complexities in the laws on buying and carrying guns.
HOW DID KELLEY MANAGE TO BUY A GUN?
Under federal law, anyone convicted of domestic violence cannot purchase a firearm. But the Air Force failed to inform federal law enforcement authorities that Kelley was court-martialed for assaulting his wife and cracking her son's skull. When he tried to buy guns after his release from a military prison, his conviction was not in the database used to conduct background checks, and the purchases went through.
HOW DOES FEDERAL LAW ENFORCEMENT CHECK SOMEONE'S BACKGROUND FOR A GUN PURCHASE?
A licensed gun dealer submits the paperwork to the FBI to run a background check. There are essentially three databases that combined make up what is known as the NICS, or National Instant Criminal Background Check System. Records are searched in the National Crime Information Center, which contains restraining orders and warrants; the Interstate Identification Index, which holds convictions; and the NICS Index, which has mental health commitments and dishonorable discharges from the military.
SO WHY WAS HE FLAGGED WHEN HE APPLIED FOR A PERMIT TO CARRY A FIREARM IN TEXAS?
State standards for who can carry a gun in public can be different from the federal standards for buying a weapon. And the background checks can be different.
In Texas, someone applying for a permit can be turned down for being charged with or convicted of certain misdemeanors or for being delinquent in child support — things that don't prevent someone from buying a gun. Texas uses a variety of databases, including NICS as well as statewide criminal databases.
The Texas Department of Public Safety said Kelley sought a permit in 2015, but the application was delayed "due to a possibly disqualifying issue." When Kelley failed to respond to the agency's request for more information, he was denied. The "disqualifying issue" has not been identified, but his 2014 misdemeanor animal-cruelty conviction for beating his dog in Colorado could have been enough.
WHAT ARE SOME OTHER REASONS PEOPLE CAN BE DENIED A CARRY PERMIT THAT WOULDN'T PROHIBIT THEM FROM BUYING A GUN?
It varies from state to state. Some, such as Hawaii, have very strict standards. There you must demonstrate to the local police chief that you have an "exceptional case" and a very specific reason for needing to carry a gun in public. Other states, such as Vermont, don't require a license to carry a firearm.
In some states, the agency that reviews such applications uses only NICS. Others might use other criminal databases that aren't linked into the NICS system. Some might rely on local police reports and flag anything that suggests a history of violence, even if the charges did not result in a conviction.
TEXAS IS AN "OPEN CARRY" STATE. DID KELLEY EVEN NEED A LICENSE TO CARRY HIS WEAPONS?
Texas requires a permit to carry a handgun in public. No permit is required to carry a rifle or a shotgun. Kelley used an assault rifle in the church attack and was also found with two handguns.