The National Rifle Association (NRA) has lost its first legal battle against the City by the Bay over the banning of high-capacity magazines in city limits.

San Francisco’s mayor, Edwin Lee, approved an ordinance last November that prohibits residents from possessing firearms with clips that hold more than 10 rounds of ammunition. Individuals owning such weapons must turn them into police, sell them to licensed gun dealers, or remove them from the city by April 7.

The NRA filed suit on behalf of the San Francisco Veteran Police Officers Association, retired officer Larry Barsetti, retired U.S. Navy master chief Arthur Ritchie, and city residents Rainerio Granados, and Randall Low to stop the law from going into effect.

They argued before U.S. District Judge William Alsup that the ordinance violates the Second Amendment by limiting Americans’ right to defend themselves.

But Alsup rejected the plaintiffs’ claim and let the law stand.

“Although there will be some occasions when a law-abiding citizen needs more than ten rounds to defend himself or his family, the record shows that such occasions are rare,” Alsup wrote in his ruling (pdf).

He added that citizens would still have the ability to own and use more than one magazine holding 10 bullets each if such a need arose.

“Moreover, it would be perfectly lawful under the San Francisco ordinance to carry or keep two magazines, each holding ten rounds, for a total of twenty rounds—even more if more magazines are desired. If and when the first magazine ran out, the self-defender could eject it and insert a backup,” Alsup wrote.

The NRA offered no comment to the media following the ruling.

But lawyers for the gun-rights organization did say they intend to appeal the decision to the Ninth Circuit Court of Appeals, according to The San Francisco Appeal.