In 2012, Devin Patrick Kelley was court-martialed by the U.S. Air Force and sentenced to a year in military prison for assaulting his wife and child. On Sunday, he used an assault-style rifle, a Ruger AR-556, to slaughter 26 people in a Texas church.

Under federal law, abusers convicted of a domestic violence crime are prohibited from purchasing or possessing firearms. But in 2016, Kelley bought the weapon he used in the attack from a licensed dealer in San Antonio, news reports have said. Two other guns found in his vehicle were also lawfully purchased. So why was he able to buy them?

We now know that the Air Force did not report Kelley’s conviction for domestic abuse to the Federal Bureau of Investigation — an oversight that The New York Times has reported is quite common.

If the military is failing to report its domestic violence convictions in a way that gun background check examiners can use to stop prohibited gun sales, it would amount to yet another way that law enforcement authorities, local and state officials, and courts across the United States, are failing to ensure that abusers aren’t allowed to acquire guns. Here are other breakdowns in the system:

Reporting Holes

It isn’t just the military. In most cases, local agencies don’t have a system in place for submitting the names of people with restraining orders or domestic violence convictions to the National Instant Criminal Background Check System (NICS) — so those names simply aren’t entered. Connecticut, Louisiana and New Mexico are among a handful of states that have tried to do better. Each has entered more than 20,000 misdemeanor domestic violence records into NICS.

The Default-Proceed Loophole

Just because someone’s name is not entered in NICS doesn’t necessarily mean that a federal gun background check reviewer wouldn’t raise a red flag at the point of sale. That’s because background checkers also check two other databases, the National Crime Information Center (NCIC) and the Interstate Identification Index, which contain more arrest records. But those records aren’t always complete, and may require further investigation by the reviewer. For example, they don’t always indicate whether an arrest was followed by a conviction. Or a court record might not specify the relationship between perpetrator and victim. If tracking down that information takes more than 72 hours, a gun dealer can make the sale anyway.

The Boyfriend Loophole

Federal domestic violence laws don’t include people who never lived with, or had a child with, the perpetrator. Known as the “boyfriend loophole,” the omission allows many abusers to buy guns even if there’s been a violent assault that leads to a criminal conviction. About a third of states have laws that aim to bridge this gap.

The Sibling Loophole

Under federal law, the abuse of a sibling doesn’t trigger a gun ban.

The Stalker Loophole

Stalkers convicted of misdemeanor crimes are not prohibited by federal law from buying or possessing guns. According to a 1999 study, 76 percent of women who were murdered by intimate partners were first stalked by their killer. A conviction for felony stalking is considered a prohibiting offense.

The No-Background-Check-Required Loophole

Federal law does not require background checks when a gun sale takes place between private individuals. In many states, it’s not hard for a domestic abuser to buy a firearm at a gun show, over the Internet, or through the classified ads. A 2015 Harvard survey of more than 2,000 gun owners found that about 34 percent of people who bought their firearms did not go through a background check.

So an Abuser Already Has a Gun. Now What?

There’s no procedure under federal law to force people convicted of domestic abuse to surrender guns they already own. A handful of states and cities have moved to close this gap in federal law with their own relinquishment requirements. At least 10 states mandate that domestic violence misdemeanants hand over their guns, while about 15 states require subjects of domestic violence restraining orders to do so.