PHOENIX — In a partial victory for free speech rights, the state Court of Appeals ruled Thursday that gun-rights advice Alan Korwin has a legal right to post a political statement about the Second Amendment on Phoenix bus shelters.

The judges said city officials acted improperly in refusing to accept the ads because they were not limited strictly to a commercial message — in this case the topic being the training of people to handle firearms.

Judge Kenton Jones, writing for the court, said it is irrelevant there also was a noncommercial message about gun rights.

But the Goldwater Institute, which represented Korwin, did not get the larger victory it sought: A ruling by the court that Phoenix and other cities have no legal right at all to restrict the content of paid advertising on their bus shelters.

That means cities remain free to turn away entirely noncommercial messages, including political ads.

Attorney Clint Bolick said if the city files an appeal, his organization may ask the Arizona Supreme Court to consider the broader legal question. But even if that does not happen, Bolick said the ruling is important.

“It tells bureaucrats that when they are enforcing their standards they can’t act arbitrarily to deny speech,” he said. The result could be government restrictions against ads in public venues with mixed commercial and noncommercial messages cannot be enforced.

The legal dispute came after Korwin sought to buy space on bus shelters of an image of a heart with the words “Guns Save Lives” superimposed, a message saying “train your kids” and referring readers to his organization’s website for training.

But Assistant Phoenix City Attorney David Schwartz said small print around the heart contained what he called a “diatribe” about the Second Amendment, Arizona’s own laws on the right to carry a concealed weapon, and the “castle doctrine” that allows people to shoot intruders in their own homes.

He said that made the essence of the ad noncommercial, and therefore forbidden under city regulations.

Schwartz argued there is no First Amendment right of those promoting political or even religious causes to make their case on city-owned property. He said the city, as a property owner, is entitled to draw a line that permits only commercial advertising in those spaces.

Bolick conceded that’s true under a U.S. Supreme Court ruling.

But he said Arizona’s own constitution provides broader protections, saying “every person may freely speak, write and publish on all subjects.”

Under that standard, Bolick said, there is no basis for Phoenix, or any other state or local government, to unilaterally decide some types of advertising on government-owned property are unacceptable unless they have some legitimate basis.

In siding with Korwin, though, the appellate judges sidestepped the broader legal arguments. Instead, they said the city cannot reject ads with noncommercial messages as long as there also is a commercial element to the message.

Schwartz said he was reviewing the ruling with city officials and had no comment.