SAN FRANCISCO – The California Supreme Court threw out a lawsuit Thursday that sought to block an unusual law requiring new models of semiautomatic handguns to stamp identifying information on bullet casings when shots are fired to make it easier to solve crimes.

The court ruled unanimously that gun-rights groups could not overturn the requirement by arguing it was impossible to comply with the law that supporters touted as a first in the nation. The groups argued that the technology did not exist, and a law could not mandate something that was not possible.

Attorneys for the state acknowledged that microstamping technology is "emerging" but said lawmakers often enact laws to force industries to innovate.

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.

Larry Keane, general counsel for one of the plaintiffs, the National Shooting Sports Foundation, said he may ask the court to reconsider its ruling because it appeared to misunderstand the aim of the lawsuit.

It was not seeking to invalidate the state law but to block its enforcement until technology made it possible to comply with the stamping requirement, Keane said.

"It is undisputed and not contested by the state that it is literally impossible to comply," he said.

The California attorney general's office said it did not concede that compliance with the law is impossible.

"Today's ruling confirms that California can create incentives for the gun industry to make products that serve the public's needs," Attorney General Xavier Becerra said in a statement. "Innovation and technology will continue to drive California to be a leader."

Washington, D.C., has a similar law, according to the Giffords Law Center to Prevent Gun Violence, which filed a court brief in support of California's law.