SAN FRANCISCO (AP) — San Francisco lawmakers disappointed committed nudists on Tuesday by narrowly approving a ban on public nakedness despite concerns the measure would undermine the city's reputation as a sanctuary for free expression.

The Board of Supervisors voted 6-5 in favor of a public safety ordinance that prohibits exposed genitals in most public places, including streets, sidewalks and public transit. The law still must pass a final vote and secure Mayor Edwin Lee's signature to take effect early next year.

Supervisor Scott Wiener introduced the ban in response to escalating complaints about a group of men whose bare bodies are on display almost daily in the city's predominantly gay Castro District.

"The Castro, and San Francisco in general, is a place of freedom, expression and acceptance. But freedom, expression and acceptance does not mean anything goes under any circumstances," Wiener said Tuesday. "Our public spaces are for everyone, and as a result it's appropriate to have some minimal standards of behavior."

Weiner's opponents on the board said a citywide ban was unnecessary and would draw police officers' attention away from bigger problems while undermining San Francisco values like tolerance and appreciation for the offbeat.

"I'm concerned about civil liberties, about free speech, about changing San Francisco's style and how we are as a city," Supervisor John Avalos said. "I cannot and will not bite this apple and I refuse to put on this fig leaf."

To make his point, Avalos showed his colleagues a clip from the 1970 movie version of Joseph Heller's "Catch-22." In it, Orson Welles pins a medal on a naked soldier.

"I get emails all the time about people who are upset there are homeless people, and I would be the last person to legislate a solution for people who do not want homeless people in their neighborhood," Supervisor Christina Olague said.

Wiener countered that it was inappropriate for hard-core nudists to wrap themselves in the mantle of personal liberty.

"I don't agree that having yellow hair is the same as exposing your penis at a busy street corner for hours and hours for everybody to watch as they go by," he said.

Under Weiner's proposal, a first offense would carry a maximum penalty of a $100 fine, but prosecutors would have authority to charge a third violation as a misdemeanor punishable by up to a $500 fine and a year in jail.

Exemptions would be made for participants at permitted street fairs and parades, such as the city's annual gay pride event and the Bay-to-Breakers street run, which often draws participants in costumes or various states of undress.

A federal lawsuit claiming the ban would violate the free speech rights of people who prefer to make a statement by going au naturel was filed last week in case the ordinance passes.