Law-abiding Californians' right to buy and sell AR-15s and other popular semi-automatic rifles shrank this week after a judge upheld state rules targeting "assault weapons."

The National Rifle Association's state affiliate had challenged rules, set to take effect on July 1, that expand the existing definition of "assault weapon" to include centerfire rifles with "bullet buttons," plus a slew of handguns and shotguns. Those rules, the group's lawsuit argued, extend far beyond what a 2016 state law authorized.

"The legislature has found and declared that the proliferation and use of assault weapons poses a threat to the health, safety, and security of the citizenry of California," Superior Court Judge Mark Snauffer, a Democratic appointee in Fresno, wrote in an little-noticed opinion published Wednesday. "The challenged regulations appear to carry out the intention of the legislature."

Snauffer's decision underscores how hostile to gun owners the California judiciary has become. Just as the state is trying to nullify federal marijuana and immigration laws, it's also trying to effectively nullify the federal Second Amendment. And unless the U.S. Supreme Court steps in, California's anti-gun politicians and bureaucrats might get away with it.

"We're disappointed but not surprised," says Sean Brady, an attorney at Michel & Associates who represents the California Rifle and Pistol Association in the case, known as Villanueva v. Becerra. "These complex technical cases are usually challenging, particularly when you're up against the state."

The technical question arises from a fairly straightforward law. In 2016, the California legislature expanded the definition of so-called assault weapons to sweep in ones outfitted with a bullet button. A bullet button is a quick release system that allows magazines to be swapped in and out by using a bullet tip as a tool. The goal of the law was to restrict removable magazines.

But the state Department of Justice seems to be targeting more firearms—and requiring their registration by July 1 upon pain of criminal penalties—than the law actually authorizes. The plaintiffs argue, convincingly, that the department "has promulgated and is currently enforcing a whole host of regulations that go far beyond the registration process without adhering to the [Administrative Procedure Act's] requirements."

For instance, the regulations reclassify certain shotguns as assault weapons (assault shotguns?), move up the deadline for obtaining a serial number for 3D-printed or homemade firearms, and limit the definition of "family member" for joint registrations of affected firearms.

Under California law, probably the most Draconian in the country, so-called assault weapons are heavily restricted. They cannot be rented at gun ranges. They cannot be inherited. They cannot be sold to another California resident. They cannot be imported. And owning one is a crime unless it's registered with the government. Officials appear to hope that the number of Californians with fully functional AR-15s or equivalents will keep shrinking and eventually, with time, drop to zero.

In addition to this administrative challenge to the 2016 Assault Weapons Control Act, the California Rifle and Pistol Association filed a constitutional challenge invoking the Second Amendment. It had no more success. U.S. District Judge Josephine Staton, an Obama appointee, sided with the state a few weeks ago, saying: "Even an outright ban on certain types of semiautomatic weapons does not substantially burden the Second Amendment right."

A third lawsuit challenging the Assault Weapons Control Act on both constitutional and administrative grounds has been on hold since it was filed in November. Plaintiffs in this case, Holt v. Becerra, include the Firearms Policy Coalition, the Firearms Policy Foundation, the Calguns Foundation, and the Second Amendment Foundation.

"We're very disappointed in what I think is a very wrong ruling by the court in Fresno," says Brandon Combs, president of the Firearms Policy Coalition. "We're reviewing it and reviewing options. We'll do the best we can to give gun owners a fighting chance."

Given the political leanings of much of the California judiciary, that's unlikely to happen anytime soon. Instead, this week's decision will embolden government officials working diligently to turn the Golden State into a Second Amendment–free zone.