Gun owners and advocates wasted little time Wednesday in challenging San Francisco's newly enacted prohibition on handgun possession by filing a lawsuit in the same court that tossed out a local handgun ban 23 years ago and vowing to, if necessary, use shotguns to protect themselves.

The lawsuit argues that Proposition H, approved Tuesday by 58 percent of the city's voters, oversteps local government authority and intrudes into an area entirely regulated by the state.

But even with the pending court case, some gun owners are preparing for the possibility of having to give up their handguns on Jan. 1, when the law is scheduled to take effect.

"I have a shotgun. I bought it first thing when I heard this was going on the ballot," said Mike Ege, who also owns two handguns and is a spokesman for the Prop. H opponents. "I'm getting a safety deposit box out of the county (for the handguns)."

The measure doesn't make it illegal for San Franciscans to possess shotguns, like the 12-gauge with an 18-inch barrel that Ege keeps in his home.

Under Prop. H, residents have until April 1 to surrender their handguns to police without penalty. The proposition also makes it illegal to sell, manufacture and distribute firearms and ammunition within city limits.

But the lawsuit filed by the National Rifle Association argues that California law, which authorizes police agencies to issue handgun permits, implicitly forbids "local attempts to ban the possession of handguns by law-abiding, responsible adults."

Plaintiffs in the lawsuit -- filed in the first district state Court of Appeal in San Francisco -- also include California Association of Firearm Retailers, two other organizations and seven individual gun owners. They argue that the new handgun ban is virtually identical to a 1982 ordinance that was struck down by the appellate court on the ground that it conflicted with state law.

The court's statement in 1982 -- that "the Legislature intended to occupy the field of residential handgun possession to the exclusion of local governmental entities" -- applies equally to Prop. H, according to the lawsuit.

"We're opposed to this because it affects only law-abiding San Franciscans," Andrew Arulanandam, the NRA's director of public affairs, said Wednesday. "Any law-abiding resident right now who has a gun ... if this proposition becomes law, they're immediately criminals. They either have to surrender their firearms. or the mayor has to instruct law enforcement to confiscate firearms."

The law doesn't spell out what the penalties would be for residents caught possessing handguns. Prop. H leaves it up to the city's Board of Supervisors to vote on penalties.

A San Francisco police spokeswoman said Wednesday the department was consulting with the city attorney's office on how to enforce the ban.

Prop. H, the lawsuit also claimed, is so loosely drafted that it would require police to leave their guns at the station, force museums to give up their gun collections and interfere with television productions and even the performances of operas like "Tosca" and "Carmen."

Larry Barsetti, a retired San Francisco police lieutenant who is one of the plaintiffs, owns three handguns and has a license to carry a concealed weapon, but he said he now fears that Prop. H means he will not be able to carry a gun on the streets of the city he once patrolled.

"My problem is if I can't have a handgun when I go to any of the areas were I worked for 30 years and arrested thousands of people, I can't protect myself," he said.

Supervisor Chris Daly, author of the measure, said that police are exempt from the handgun ban and that TV productions and operas can use props. Daly also said Prop. H was drafted to stay within the limits of local authority by prohibiting only San Francisco residents, not visitors, from possessing handguns.

That limitation "makes it more likely that courts would say it is a municipal affair," said City Attorney Dennis Herrera, whose office will defend the measure.

He also noted that the state Supreme Court, in a 2002 ruling allowing counties to ban gun shows on public property, declared that California law doesn't entirely prohibit gun regulation. That ruling, however, did not define the boundaries of local and state authority or expressly authorize a city to forbid gun possession within its borders. Those questions may be answered by the current case.

Questions lingered about the enforceability of Prop. H, and many gun owners on Wednesday wondered what it all meant for them.

A San Franciscan who wanted only to be identified by his first name, David, said that owning a gun was a private matter and criminals might target residents who would be unarmed under the legislation.

He owns a shotgun and said he would be left to use that in self-defense.

"But my wife is about 95 pounds, and she can't lift the gun and can't control it," he said of his shotgun. "My biggest concern is not myself. ... It's the fact that my wife will be defenseless and every criminal in the Bay Area will know that."

David said he didn't want to break the law and keep his collection of half a dozen handguns if Prop. H forbids it, but he remains concerned about his family's safety.

"For me, it's kind of a fundamental human right," he said, "that I have a right to protect myself and my family."