A federal court in California has slammed the door on an attempt by Alameda County to zone gun stores out of existence.

The Second Amendment protects the right to buy and sell firearms, as well as the right to keep and bear them, a federal appeals court ruled on Monday.

In doing so, the San Francisco-based Ninth U.S. Circuit Court of Appeals revived a lawsuit filed by three business partners who had planned to open a gun store in Alameda County, Calif., but were denied a zoning permit.

“If ‘the right of the people to keep and bear arms’ is to have any force, the people must have a right to acquire the very firearms they are entitled to keep and to bear,” wrote Judge Diarmuid F. O’Scannlain for the 2-1 majority, quoting the Second Amendment. “One cannot truly enjoy a constitutionally protected right when the state is permitted to snuff out the means by which he exercises it.”

The ruling by the Ninth Circuit builds on previous decisions by federal appeals judges recognizing the right to buy ammunition and to train at firing ranges as protected by the Second Amendment.

Alameda County had concocted a scheme in which gun stores in the densely packed county of more than 1.5 million souls could not be established within 500 feet of a home. The proposed store at the center of the case was 446 feet from the nearest home.

Alameda County’s anti-gun Democrats had grandfathered in existing gun stores in the county, but would not allow the establishment of any new gun stores, and it doesn’t appear that they would approve the establishment of new gun stores at the locations of existing gun stores once those existing stores closed.

The clear intent of the law was to make it very difficult for Alameda County residents to buy firearms by forcing them to travel outside of the county to exercise their right to bear arms.

Alameda County, based on Oakland, is now in the process of trying to determine if they will appeal the court’s decision.

Oakland has long been know as the “crime capital” of the San Francisco Bay Area, with a thriving thug culture and the infamous and well-earned reputation as one of the most dangerous cities in the United States.