A carveout in a California gun law reportedly allowed for the legal purchase of two assault-style rifles that were used in the San Bernardino shooting Wednesday, which killed 14 people and injured 21 others, though the weapons were later altered illegally.

Many guns in the style of the two AR-15 semiautomatic rifles, a .223-caliber DPMS Model A15 and a Smith & Wesson M&P15, are banned under a 1989 California gun law targeting assault weapons. The law specifically targets assault rifles with magazines that are detachable by hand, in order to prevent users from reloading quickly and inflicting mass damage.

But if the guns are equipped with a “bullet button,” as the Wall Street Journal reports the San Bernardino shooters’ were, they’re perfectly legal to sell. Instead of removing a magazine by hand, the shooter must press a recessed button that is only accessible using the tip of a bullet or another small tool. Technically, this does not classify as a “detachable magazine,” so the guns are allowed. In practice, the method still allows users to swap out magazines within seconds. Gunmakers began making bullet buttons after California passed its harsher gun laws, according to the Associated Press.

But in this case, the weapons were additionally altered in a way that violated the California law, the Journal reports, allowing one to use higher-capacity magazines than permitted.

The two gunmen fired 65 to 75 rounds during the attack and then another 76 rounds in a later shootout with police, according to officials. They had more than 1,400 more assault rifle rounds on their bodies and in their vehicle.

A gun with a bullet button was also used in the 2013 shooting at Los Angeles International Airport that left a TSA agent dead, according to the Violence Policy Center, a gun safety advocacy group.

In 2013 California’s legislature passed a bill that would have outlawed all semi-automatic rifles that had the capacity to accept detachable magazines, including guns equipped with bullet buttons, but Governor Jerry Brown vetoed the measure, saying it and other proposed gun control measures went too far in their restrictions.

While some have called the law’s allowance of bullet buttons a “loophole,” gunmakers have pushed back against the characterization. The addition of bullet buttons was “simply the industry trying to comply with the State of California’s law and regulations,” the National Shooting Sports foundation told the New York Times.

While the bullet button remains legal, the shooters altered their weapons in illegal ways, a Bureau of Alcohol, Tobacco, Firearms and Explosives official told the Journal. One of the rifles was changed to use a larger magazine (California bans magazines larger than 10 rounds), while the other was tweaked in an attempt to make it fire fully automatically.

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.