San Francisco’s public nudity ban will go into force on Friday – it has been confirmed by a US district court judge.

Lawmakers in San Francisco narrowly approved the ban after complaints regarding the city’s famous gay Castro district in November of last year.

The month before, District Supervisor Scott Wiener pushed for the nudity ban in answer to constituents fed up with seeing naked men hanging out in the district.

The area, famous for its LGBT community and the legendary story of gay rights campaigner and politician Harvey Milk, had previously long been tolerant of public nudity.

On Tuesday, US District Court Judge Edward Chen ruled that a new city ordinance does not violate the free speech rights of residents and visitors.

Judge Chen refused to block the ban temporarily or to allow a lawsuit challenging it to proceed, the Associated Press reports.

In his 18-page opinion, Judge Chen wrote: “In spite of what plaintiffs argue, nudity in and of itself is not inherently expressive.”

The San Francisco Board of Supervisors voted 7 to 4 last month to prohibit residents and visitors over age 5 from exposing their genitals on public streets, in parks or plazas – or while using public transit.