The Second Amendment of the U.S. Constitution still guarantees the right to bear arms. But the 9th U.S. Circuit Court of Appeals in California ruled Tuesday that county governments have the right to restrict the location of gun stores.

The ruling by the court’s 11-judge panel upheld a California county's ordinance banning new gun stores within 500 feet of schools, day-care centers, residential areas, liquor stores and other gun shops.

A majority of the panel said the law did not violate the Second Amendment right to bear arms of would-be gun owners because there were other stores in the county where they could buy a gun.

“Gun buyers have no right to have a gun store in a particular location, at least as long as their access is not meaningfully constrained," Judge Marsha Berzon said.

Lead plaintiff John Teixiera wanted to open a gun shop in San Leandro, Calif., but Alameda County denied his application because the shop would have been located near two residential areas, the East Bay Times reported.

The majority also rejected the argument that gun sellers' Second Amendment rights were violated, saying there is no constitutional right to sell guns.

The ordinance at issue was passed by Alameda County, across the bay from San Francisco. A phone message after hours to an attorney for groups that challenged the law was not immediately returned.

The ruling overturned a decision last year by a three-judge panel of the 9th Circuit that said the Second Amendment extends to gun stores and requires governments to justify restrictions on them.

That panel in a 2-1 decision said Alameda County had to present evidence to justify the restriction on gun store locations.

It was not immediately known if Teixiera and the other plaintiffs would pursue a Supreme Court case, the East Bay Times reported. The other plaintiffs are Second Amendment advocacy groups Calguns Foundation Inc., Second Amendment Foundation Inc., and the California Association of Federal Firearms Licensees.

The Associated Press contributed to this story.