An 11-judge panel of the 9th U.S. Circuit Court of Appeals in San Francisco by a 7-4 vote upheld the policy, which was in effect in city jails from 2002 to 2004.
The court majority said the policy was a reasonable way to address security concerns of weapons and drugs being smuggled into the jails.
Judge Sandra Ikuta wrote, "The evidence shows that arrestees do, in fact, have both the opportunity and inclination to conceal contraband in private bodily areas...and that a strip-search policy may have a deterrent effect."
Under the former policy, sheriff's deputies searched all suspects who were arrested and expected to stay in the jail system for more than 24 hours, regardless of the crime with which they were charged.
The inspections of nude suspects were conducted visually, with no touching, in private by sheriff's deputies of the same gender.
Nine people who were strip-searched sued the city and Sheriff Michael Hennessey in 2003, arguing that searches were unconstitutional in the cases of people for whom there was no suspicion of drugs or weapons smuggling.
In 2004, while the lawsuit was pending, Hennessey changed the policy to restrict the searches to arrestees charged with drug or violent crimes, on parole or probation, possessing a criminal history or individually suspected of concealing weapons or drugs.
The 11-judge court overruled a decision in which a smaller panel of the same court said by a 2-1 vote in 2008 that the broader searches were unconstitutional.
Joanne Hoeper, the chief trial attorney in the San Francisco city attorney's office, said, "Today the court recognized the danger to the public, to arrestees and to jail security of drugs and weapons smuggled into jails."
A lawyer for the plaintiffs was not immediately available for comment on the ruling, which could be appealed to the U.S. Supreme Court.