A judge struck down San Francisco's voter-approved ban on handgun possession Monday, saying local governments have no such authority under California law.

Proposition H, which passed with a 58 percent majority in November, would have outlawed possession of handguns by all city residents except law enforcement officers and others who need guns for professional purposes. It also would have forbidden the manufacture, sale and distribution of guns and ammunition in San Francisco.

San Francisco Superior Court Judge James Warren agreed with the National Rifle Association, which argued that Prop. H exceeded the powers of local government and intruded into an area regulated entirely by the state. The NRA sued on behalf of gun owners, advocates and dealers the day after the measure passed. Enforcement of the measure was suspended while the suit was pending.

Warren said California law, which authorizes police agencies to issue handgun permits, implicitly prohibits a city or county from banning handgun possession by law-abiding adults.

That law "demonstrates the Legislature's intent to occupy, on a statewide basis, the field of residential and commercial handgun possession to the exclusion of local government entities," Warren wrote in a 30-page decision.

If the city were allowed to ban handguns within its borders, he said, nearby counties could be flooded by handguns no longer allowed in San Francisco. Such a possibility illustrates the need for gun ownership to be regulated on a state level, Warren said.

"California has an overarching concern in controlling gun use by defining the circumstances under which firearms can be possessed uniformly across the state, without having this statewide scheme contradicted or subverted by local policy," the judge said.

He declined to consider the ban on sales of other types of guns and ammunitions separately, saying it could not be detached from the handgun ban, the dominant provision of Prop. H. "The focus of the public debate ... was all on the effect of the ordinance in barring handguns," and there is no evidence that voters would have approved the other restrictions as a separate measure, Warren said.

Chuck Michel, the NRA's lawyer, said his clients were "thrilled that the judge recognized that law-abiding citizens who possess firearms to defend themselves and their families are part of the solution and not part of the problem." Rather than banning such weapons, he said, the city should include gun owners in an effort to "fight the criminal misuse of firearms, which is a goal that we all have in common."

City Attorney Dennis Herrera, whose office defended Prop. H, will decide whether to appeal the ruling in the next day or two, said spokesman Matt Dorsey.

"We're disappointed that the court has denied the right of voters to enact a reasonable, narrowly tailored restriction on the possession of handguns," Dorsey said.

Supervisor Chris Daly, a chief sponsor of Prop. H, urged Herrera to appeal and criticized Warren. The judge "sided with the powerful gun lobby against the safety of San Franciscans" after showing "disregard for the voters of San Francisco" by taking nearly three months to rule, Daly said.

The court to which Herrera would appeal Warren's decision may have sounded the death knell for measures like Prop. H in 1982, when it overturned a San Francisco ordinance forbidding possession of handguns within city limits and said state law left such regulation to the Legislature.

Sponsors of Prop. H had hoped to comply with the 1982 ruling by drafting a narrower measure that applied only to San Francisco residents. Gun control advocates were also encouraged by state Supreme Court rulings allowing local governments to ban gun possession on public property and to prohibit possession of the cheap handguns known as Saturday-night specials.

But Warren said the local impact of Prop. H was outweighed by its potential effect on neighboring communities, and by the state's interest in uniform statewide regulation.