SAN FRANCISCO (BCN) — A divided federal appeals court ruled in an Alameda County case Monday that the constitutional Second Amendment right to bear arms includes a right to buy and sell guns, although with some limits.

A three-judge panel of the 9th U.S. Circuit Court of Appeals in San Francisco said by a 2-1 vote that “the right to purchase and to sell firearms is part and parcel of the historically recognized right to keep and to bear arms.”

The panel issued the ruling in a challenge by three business partners to an Alameda County law that requires gun stores in unincorporated areas to be at least 500 feet from a residential area.

The three men wanted to open a gun and firearms training store in an unincorporated part of San Leandro, but county zoning administrators found that the site was within 500 feet of a residential area.

A federal trial judge dismissed the lawsuit, saying that the county had a rational basis for enacting the law to protect public safety and preserve the character of residential zones.

In Monday’s ruling, Circuit Judge Diarmuid O’Scannlain noted that the U.S. Supreme Court, in its landmark 5-4 ruling in 2008 by the late Justice Antonin Scalia affirming an individual right to possess guns, had said that laws imposing conditions on commercial gun sales were permissible.

But O’Scannlain, joined by Judge Carlos Bea, said that since the ability to procure guns is “close to the core of the Second Amendment,” any regulation of stores must be justified by a rigorous standard known as

heightened scrutiny.

O’Scannlain and Bea said the county government would have to show a substantial or significant objective for the law and a “reasonable fit” between that objective and the law.

The court majority said the county hadn’t done that so far because in the lower court proceedings, it hadn’t provided evidence that legal gun stores increase crimes or harm neighborhood aesthetics.

The court sent the case back to the court of U.S. District Judge William Orrick in San Francisco for further proceedings under the heightened standard.

Justice Barry Silverman said in a dissent that the county law doesn’t impede the right to bear arms because there are at least 10 legally operating gun stores in Alameda County.

“When you clear away all the smoke, what we’re dealing with here is a mundane zoning dispute dressed up as a Second Amendment challenge,” Silverman wrote.

County Counsel Donna Ziegler said, “We’re in the process of reviewing the case” and said county officials had not yet decided on their next step, which could be either appealing to an expanded 11-judge panel of the circuit court or returning to the trial court.

“We do intend to continue defending the law,” Ziegler said.Donald Kilmer, a lawyer for the businessmen who challenged the law, said, “The court is saying that if you’re going to impose a regulation, the government has to come forward and show the evidence.”

Kilmer said he and his clients don’t oppose regulations such as requirements for parking places, security and barred windows at gun stores, but contend there is no evidence that sales of guns by law-abiding store owners to law-abiding citizens cause crime.