Legislators in San Francisco in the United States have narrowly approved a ban on public nudity in the city.

They voted to prohibit people from exposing their genitals in most public places.

The move is in response to people who have taken to walking naked in the city's predominantly gay Castro District.

Exceptions will be allowed for certain street fairs and events.

District Supervisor Scott Wiener introduced the measure after escalating complaints.