For advocates of stricter gun laws, a sweeping package of new legislation signed by California’s governor in July 2016 — and a similar set of measures approved by the state’s voters in a referendum four months later — served as rare bright spots in a year that they would otherwise rather forget.

The new restrictions included an expanded version of the state’s assault weapons ban, designed to close a loophole that had been exploited just months earlier by ISIS-inspired gunmen; a prohibition on owning high-capacity magazines; and a requirement for background checks on sales of ammunition. California’s beefed-up laws came as many other states, including Missouri, Mississippi, and Tennessee, moved in the opposite direction, loosening restrictions on who can legally carry weapons, and where they can carry them.

But implementing several of California’s most significant new laws has proved surprisingly difficult, raising questions about the state’s process for rolling out what would be among the most stringent firearm restrictions in the United States — and highlighting the legal and practical obstacles that come when a state seeks to impose rules that affect large numbers of gun owners.

“It’s part of the landscape now that any new law or regulation will be subject to some sort of challenge,” said Garen Wintemute, who studies gun policy and violence at the University of California, Davis. “There’s going to be uncertainty about whether or when it’s enforceable.”

The first blow to the package of laws came June 26, when an obscure state office found that Attorney General Xavier Becerra improperly withheld a new assault weapon regulation from a review process that grants time for public comment. Under the new law, owners with rifles equipped with “bullet buttons” — a device that allows for the release a gun’s magazine — would have to register their firearms with the California attorney general by year’s end. The finding, by the Office of Administrative Law, hampered Becerra’s attempt to launch a functioning registration system before the looming January 1 deadline. The deadline has since been pushed back.

Then, just three days later, on June 29, a federal judge in San Diego issued a preliminary injunction halting the statewide ban on the possession of magazines with a capacity of more than 10 rounds from taking effect July 1. The ruling came at the request of lawyers from the National Rifle Association’s state affiliate.

“If this injunction does not issue, hundreds of thousands, if not millions, of otherwise law-abiding citizens will have an untenable choice: become an outlaw or dispossess one’s self of lawfully acquired property,” District Judge Roger Benitez wrote. “That is a choice they should not have to make.”

California’s most recent push for gun reform was prompted by the state’s worst mass shooting in decades. In December 2015, an ISIS-inspired husband and wife fatally shot 14 people at a San Bernardino social services center. Both killers used rifles modified with bullet buttons and high-capacity magazines. By July 2016, the state legislature had passed 11 bills limiting access to firearms. Governor Jerry Brown signed six into law.

Some lawmakers saw the bullet-button ban as a long overdue fix to the state’s 1999 assault weapons law. That legislation outlawed semiautomatic centerfire rifles that had both the ability to accept detachable magazines and were equipped with at least one other feature, like a pistol grip. Rifles remained legal if the magazine met the definition of “fixed,” or required a “tool” to be released from the gun. Darin Prince, a San Diego gun dealer, skirted that stipulation by inventing the bullet button. Installed on a rifle, the device lives up to its name: using a tool as simple as the tip of a bullet, a gun owner can quickly eject a spent magazine and load another.

A demonstration of the bullet button’s release mechanism.

The bullet-button workaround exposes what critics say is a fatal flaw of practically any law that seeks to impose bans on certain types of weapons. Because they often target specific features of weapons — and not broad categories — the laws are vulnerable to workarounds by savvy gun manufacturers and gunsmiths. Already, there are several devices available for sale in California that seek to subvert the state’s expanded assault weapons ban.

Don Perata, a former state Senate leader, said that for gun laws to be truly effective, lawmakers must closely monitor what happens after they pass, and move quickly to address shortcoming or close loopholes. The bullet button has been available for purchase for more than a decade, but it took a high-profile mass shooting for lawmakers to act.

“We’ve gotten used to passing laws and moving on,” Perata said. “You vote for a bill, and it ends up with the bureaucracy, so there’s been no systematic attention to the aftermath.”

Legal sales of the bullet button ended on Dec. 31, 2016. Under the expanded assault weapons ban, individuals who own guns with bullet buttons must uninstall the devices, surrender them to law enforcement or register their firearms by January 1, 2018.

After California implemented the first version of its assault weapons ban nearly 20 years ago, gun owners registered more than 145,000 firearms. But the last registration window closed in 2001. In order to give gun owners an opportunity to register under the new law the state must create a new system, through which owners would supply personal information, serial numbers, photos, and other descriptions of their firearms. The California Bureau of Firearms state expects 250,000 gun owners to register between 1-1.5 million rifles as a result of the expanded law.

The California Office of Administrative Law reviews new regulations for their “legal and procedural compliance” before they can become law. In December 2016, the California Department of Justice submitted a proposal to the office describing how the new assault weapon regulations and registration system would work.

Gun-rights groups were quick to challenge that proposal. In January, a legal team supported by the NRA and the California Rifle and Pistol Association sent a letter to the California Department of Justice describing the regulations as “unlawful,” and “riddled with other flaws that make administration, interpretation, and enforcement highly problematic.” The groups demanded that the proposal be withdrawn, and promised to file a lawsuit if their request was not met.

The following month, the attorney general’s office withdrew its proposal. Beccerra’s office did not offer a statement revealing why, but the move suggested that the administrative law office had taken issue with the proposal.

Gun-rights groups celebrated the news. “The regulations submitted by DOJ to OAL went far beyond what is necessary for the registration process and read more like a wish list from the gun ban lobby,” a post on the NRA’s website reads.

Late last month, the administrative law office also rejected a revised version of the rules. The office said the DOJ had failed to provide a period of public notice and comment for the pending regulations, a process that takes at least six months. Becerra may now appeal the denial, submit to the months-long review, or propose a new version of the rules. A spokeswoman declined to comment on how the department would proceed.

“They’re understaffed, overworked, and uninformed, and it’s only going to get worse,” said Chuck Michel, a lawyer for the NRA and the California Rifle and Pistol Association, about the attorney general’s office.

On June 27, Brown signed a bill that postpones the registration deadline for assault weapons by six months. Brown’s office and lawmakers who sponsored the deadline extension declined to discuss it. One state Senate staffer, who requested anonymity, said it wouldn’t be a surprise to see another extension.

Gun-reform advocates aren’t worried about the delay. “I don’t see this as a catastrophe,” said Amanda Wilcox, the legislative chair of the Brady Campaign to Prevent Gun Violence’s California chapter. “It’s a setback, but I take the long-term view. The important thing is that people can’t buy them [bullet-button firearms].”

The sale of high-capacity magazines — defined by the state as those able to accept more than 10 rounds — have been prohibited for sale or transfer in California since 2000. As in the case of the assault weapons ban, existing owners were grandfathered in — only, unlike the earlier ban, they were not required to register them.

Some cities in the state, including Los Angeles and San Francisco, went further by extending the magazine ban to include possession of high-capacity magazines. The new law follows their lead, banning ownership statewide.

Benitez’s preliminary injunction put him at odds with other federal courts that had previously upheld local restrictions in the face of challenges from gun-owner groups.

Benitez’s order said that California’s web of gun laws are byzantine and he expressed confidence that the magazine ban would get struck down for violating the Second Amendment right to bear arms for self-defense.

“The California matrix of gun control laws is among the harshest in the nation and are filled with criminal law traps for people of common intelligence who desire to obey the law,” the judge wrote.

The fight against the magazine ban shows how the NRA and like-minded organizations have evolved to fight new restrictions in a state where Democrats control both the legislature and the governor’s office.

“They’ve waged a very concerted effort to file as many legal arguments to see what sticks.” said Ari Freilich, a San Francisco attorney for the Law Center to Prevent Gun Violence. “It’s what they have left. They have lost overwhelmingly at the ballot box.”

The highest-profile challenge nearly reached the Supreme Court last month. Peruta v. San Diego argued that the California’s city’s requirements for issuing concealed-carry licenses are too harsh, and infringe on Second Amendment rights. The NRA and its state affiliate lent Peruta support. Peruta was considered the most significant firearms case in decades, but the Supreme Court declined to hear it in June.

Michel, who was the lead attorney in Peruta, said the NRA has additional lawsuits in the works, and promised to lead a challenge to licensing ammunition dealers.

If the bullet-button registration system is eventually launched, and the magazine ban implemented, enforcement will become the next dilemma for California officials. In delaying the ban on magazines, Benitez wrote that he worried that “hundreds of thousands, if not millions” of people would have to give up their magazines or become criminals.

The state estimates that hundreds of thousands of Californians own rifles equipped with a bullet-button device. Many more possess magazines defined by the state as high-capacity. If those individuals fail to register their weapons, or discard their magazines, they will be breaking the law.

Compliance with laws that require gun owners to register or relinquish their weapons is thought to be low. New York and Connecticut both passed similar bans on assault weapons after the Sandy Hook Elementary School shooting, in which a gunman killed 20 children and six educators with a rifle and high-capacity magazines. In both states, the number of firearms registered with the state is dwarfed by estimates of weapons in circulation.

Some Californians predict that compliance with the magazine ban will also be low. “I can safely say that no one has handed in a single magazine,” said a clerk at Redding Guns, located in the small Northern California town, in late June, just days before the ban was set to go into effect. “And I don’t anticipate you will find anyone anywhere who has.”