In a gun-rights case, a couple who had sold guns for years at the fairgrounds sued after Alameda County passed an ordinance banning firearms from public property.

Local governments have a legitimate purpose in keeping guns out of public places, a federal appeals court ruled Monday in a gun-rights case that has been in dispute for a dozen years.

Gun show promoters Russell and Sallie Nordyke brought a lawsuit after Alameda County officials passed an ordinance in 1999 prohibiting firearms and ammunition from public property, including the county fairgrounds where the couple had displayed and sold guns for years.

The Nordykes alleged that the county law infringed on a citizen's constitutional right to bear arms, as well as the right to free expression in displaying the guns. They also argued that it threatened to encourage the banning of gun shows from fairgrounds across the state.

A three-judge panel of the U.S. 9th Circuit Court of Appeals upheld a lower court's ruling that the ordinance was aimed at improving public safety and didn't substantially infringe on citizens' right to keep and bear arms on their own property for self-defense.

The case has moved up and down the federal court chain since the suit was filed in 2004, as judges have repeatedly been asked to review the ordinance's constitutionality in light of Supreme Court rulings on gun-control laws elsewhere. In 2008, the high court quashed a District of Columbia ban on handguns as an infringement of 2nd Amendment guarantees.

The Alameda ordinance didn't prohibit gun shows "but merely declined to host them on government premises," said the opinion written by Judge Diarmuid F. O'Scannlain, one of the court's more conservative members.

In view of the recent more vigorous defense of 2nd Amendment rights by the Supreme Court, it appeared likely that the 9th Circuit decision would be appealed to a full 11-judge en banc panel or to the high court.

"The case isn't over," said the Nordykes' attorney, Donald Kilmer. "I'm still talking with my clients, but it's just a question of whether we go up to an en banc rehearing or to the Supreme Court or back to the district court."