SAN FRANCISCO (AP) — A California requirement that new models of semi-automatic handguns stamp identifying information on bullet casings when fired is a "real-world solution" to help solve gun crimes, a divided U.S. appeals court said Friday in a decision that upheld the novel law.

The stamping requirement and two measures intended to make guns safer did not violate the 2nd Amendment because they left plenty of firearms for sale in California and were reasonable to further the state's goal of keeping people safe, the 9th U.S. Circuit Court of Appeals said in a 2-1 decision.

Gun rights advocates had argued that manufacturers didn't have the technology to implement the stamping requirement, so the law was effectively a ban on the sale of new guns in the state.

Writing for the majority, Judge M. Margaret McKeown said the inability to buy particular guns did not infringe the 2nd Amendment right to self-defense in the home.

"Indeed, all of the plaintiffs admit that they are able to buy an operable handgun suitable for self-defense — just not the exact gun they want," she said.

McKeown, joined by Judge J. Clifford Wallace, also rejected the argument that the stamping technology was impossible to implement.

The 9th Circuit was analyzing the law under a less rigorous judicial standard in order to reach its "policy preferences," said Brandon Combs, executive director of the Calguns Foundation, one of the plaintiffs.

"Really what the 9th Circuit is saying and has said in other cases basically is as long as a person that is law abiding has access to one handgun inside of their home, then that's it," he said. "That's the extent of their right. We think that's quite wrong."

In a dissenting opinion, 9th Circuit Judge Jay Bybee said there was conflicting evidence about whether the stamping requirement was technically feasible. If the state adopted a requirement that no gun manufacturer could satisfy, the law would not help the state solve handgun crimes and would illegally restrict gun purchases, he said.

Also at issue in the case were two additional state requirements that were intended to prevent accidental discharges of handguns. The 9th Circuit upheld those mandates too.

The stamping requirement — the first of its kind in the nation — requires new models of pistols to have a microscopic array of characters in two spots that identify the gun's make, model and serial number and are imprinted on the casings when the weapon is fired. The goal is to allow law enforcement to trace casings left at a crime scene to the weapons from which they were discharged.

The California law, which Gov. Arnold Schwarzenegger signed in 2007 and took effect in 2013, doesn't affect guns already on the state's official firearm roster. Only new or modified semi-automatic handguns sold in California must be equipped with the technology.

Washington, D.C., had been keeping a close eye on how California implemented the law, and now has a similar stamping requirement.

Adam Skaggs, chief counsel for the Giffords Law Center to Prevent Gun Violence, said other states will take notice of the court rulings in California.

The California Supreme Court in June threw out a separate lawsuit that sought to block the state's stamping law.

"To the extent that this is not bogged down in litigation, it's going to say to regulators elsewhere that they ought to take another, close look," he said.

In a separate decision Friday, a three-judge panel of the 9th Circuit unanimously upheld another California law that bans people licensed to carry concealed firearms from having them on school grounds.