Forcing adult actors to wear condoms while filming doesn’t violate the First Amendment freedom of speech, a federal court ruled in a legal battle over a two-year-old Los Angeles County ordinance.

The 9th Circuit Court ruled Monday in favor of Measure B, a 2012  voter-approved L.A. County ordinance that requires condoms to be used in adult films and requires filmmakers to obtain permits. Those permits must be posted at the film site along with a notice about condom use, and certain employees must undergo training about the sexual transmission of disease.

A group of studios sued the county, arguing that Measure B “burdens their freedom of expression in violation of the First Amendment.” A lower court sided with Los Angeles County, and the studios and other plaintiffs — Vivid Studios, Califa Productions, Kayden Kross and Logan Pierce — appealed to the 9th Circuit.

In its opinion, the 9th Circuit Court cited a 2000 U.S. Supreme Court decision that found prohibiting public nudity did not violate free speech. An Erie, Penn., ordinance required erotic dancers to at least wear “pasties and a G-string,” which had some “effect on the erotic message,” the Supreme Court found, but it was minimal.

The requirement that actors in adult films wear condoms while engaging in sexual intercourse might have “some minimal effect” on a film’s erotic message, but that effect is certainly no greater than the effect of pasties and G-strings on the erotic message of nude dancing,” the 9th Circuit Court’s opinion read.

The adult film industry has been resistant to condom regulations, saying they don’t need government regulations to encourage safety because it’s in their best interest to keep actors healthy and working. Mike Stabile, a spokesman for the Free Speech Coalition, told The Washington Post in August that studios had “a real investment in safety protocol” and that actors are tested for sexually transmitted infections every two weeks.

“Now it’s time to do what 57 percent of Los Angeles County voters have asked of the industry — and what the courts have upheld as constitutional,” said Michael Weinstein, president of the AIDS Health Foundation, a group that has supported the ordinance, in a statement.

Since Measure B passed, the number of adult films made in Los Angeles County had dropped from about 480 in 2012 to 40 in 2013. In August, a bill that would have required condom use in adult films statewide failed to make it for a vote in the California legislature.