By SUDHIN THANAWALA | The Associated Press

SAN FRANCISCO — The California Supreme Court on Thursday threw out a lawsuit that sought to invalidate a state law requiring new models of semi-automatic handguns to stamp identifying information on bullet casings.

The court ruled unanimously that gun rights groups could not overturn the law on the grounds that complying with it was impossible. The groups argued that technology did not exist to meet the stamping requirements, and a law couldn’t mandate something that was not possible.

Writing for six of the justices, Associate Justice Goodwin Liu said impossibility can sometimes lead courts to excuse a failure to comply with a law, but it can’t be the basis for invalidating it. The ruling overturned a lower court ruling that allowed the suit to move forward.

Start your day with the news you need from the Bay Area and beyond.

Sign up for our new Morning Report weekday newsletter.

A call to a spokesman for one of the plaintiffs, the National Shooting Sports Foundation, was not immediately returned.

Supporters of the law signed by Gov. Arnold Schwarzenegger in 2007 touted it as the first such law to go into effect in the nation and said it would help law enforcement solve gun crimes by allowing them to link bullet casings to guns.

The law requires new pistol models to have a microscopic array of characters in two spots that identify the gun’s make, model and serial number and that are transferred by imprinting on each cartridge case when the gun is fired.

Gun rights groups say it is not possible to “microstamp” two areas of a gun. Only the tip of the firing pin can be microstamped, and current technology doesn’t allow the stamp to reliably, consistently and legibly imprint on the cartridge primer from that part of the gun, they say.

Attorneys for the state acknowledged in court documents that microstamping technology is “emerging,” but they said lawmakers often enact laws to force industries to innovate. They warned a ruling in favor of gun makers could take away that power.

The law, which took effect in 2013, doesn’t impact 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.