Adding fresh ammo to the gun rights debate, a federal appeals court on Wednesday upheld Sunnyvale’s law restricting high-capacity gun magazines, concluding local officials did not run afoul of the Second Amendment by trying to reduce gun violence.

The 9th U.S. Circuit Court of Appeals rejected the arguments of groups such as the National Rifle Association, which contended the restrictions are unconstitutional and undermine gun owners’ right to protect their homes with ample firepower.

“Sunnyvale’s interests in promoting public safety and reducing violent crime were substantial and important government interests,” 9th Circuit Judge Michael Daly Hawkins wrote for a unanimous three-judge panel.

Gun rights advocates have to date failed in their legal challenge to the ordinance, which threatens criminal prosecution of anyone with a magazine that can hold more than 10 rounds of ammunition. A San Jose federal judge upheld the law last year, and the U.S. Supreme Court refused to put it on hold while the appeal unfolds.

Groups challenging the law can now ask the 9th Circuit to rehear the case with an 11-judge panel, or follow through with their plan to take the issue to the Supreme Court. Foes of the Sunnyvale law have already enlisted former U.S. Solicitor General Paul Clement, who has frequently argued in the high court, for their legal team.

Chuck Michel, a lawyer for the gun rights groups, pledged to appeal quickly, calling the ruling a “fundamental misapplication” of Supreme Court precedent. He also revealed that organizations plan to file a second legal challenge to the Sunnyvale law within the next week raising new legal arguments.

The gun lobby’s second case will rely on the argument that cities such as Sunnyvale are pre-empted from local firearms magazine regulation by California law.

California law since 2000 has banned making, selling, giving or lending magazines that can hold more than 10 rounds, but laws such as Sunnyvale’s go further by making it illegal to possess them in the home. It requires city residents to turn in illegal magazines or risk misdemeanor prosecution.

The stakes could be high, as other California cities, including Mountain View, San Francisco and Los Angeles, have moved to adopt similar regulations. And given that the 9th Circuit shapes law for nine western states, its Sunnyvale ruling is likely to have a much broader reach if it remains intact.

To gun owners, the law is an unconstitutional slap at their right to protect their homes from intruders. To advocates of the law, it is a sensible response to gun violence, such as the tragedies ranging from the Sandy Hook Elementary School massacre in Newtown, Connecticut, two years ago to Gian Luigi Ferri’s mass shootings at a San Francisco law firm two decades ago.

The 9th Circuit considered the Sunnyvale case as federal courts across the country deal with the fallout from a 2008 Supreme Court decision that strengthened the Second Amendment right to have a firearm for self-defense. Emboldened by that decision, which struck down a handgun ban, gun rights advocates have challenged state and local regulations in areas such as assault weapons and high-capacity ammunition rounds.

The 9th Circuit, however, found that Sunnyvale’s law is “simply not as sweeping” as the handgun ban invalidated by the Supreme Court, noting that it does not undercut owning a firearm for self-defense.

Sunnyvale gun owner Leonard Fyock and other local residents took on Sunnyvale’s ammo law, backed by gun rights advocates insisting that millions of Americans own such magazines to protect “hearth and home,” as they told the 9th Circuit.

Fyock declined to comment Wednesday.

Sunnyvale city leaders defending the law are backed by groups such as the Brady Center to Prevent Gun Violence. Sunnyvale pushed Measure C after the Sandy Hook shootings, in which 20 children were killed, arguing that large-capacity magazines such as were used there are unnecessary for self-defense.

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz