The most popular fashion trend in Texas this fall is probably going to be pants.

The Texas Court of Criminal Appeals on Wednesday struck down a part of the state penal code that banned people from taking photos or videos up women’s skirts in public. The state’s highest criminal court, in an 8-1 decision, said the statute violated the First Amendment’s guarantee of free speech by criminalizing photos taken for sexual gratification.

In her summary court opinion, Judge Sharon Keller said the First Amendment protects expressive speech -- in this case a “person’s purposeful creation of photographs and visual recordings.” She called the camera “essentially the photographer’s pen and paintbrush.”

The Texas statute, amended in 2007, made it a crime to take photos or videos of another person in public spaces without that person’s consent and with intent to “arouse or gratify the sexual desire of any person.” The law was meant in part to protect against predatory photographers who stealthily take photos up women’s skirts or down their blouses and then post them to the Internet. Complaints of such activity have become more commonplace in the age of smartphones.

But Keller said the law was based on a flawed legal argument, in particular because it was framed around the photographer’s intent. “Protecting someone who appears in public from being the object of sexual thoughts seems to be the sort of ‘paternalistic interest in regulating the defendant’s mind’ that the First Amendment was designed to guard against.”

As the Houston Chronicle reported, the case involved a man who was taking photographs of children in swimsuits at a San Antonio water park. The man, Ronald Thompson, challenged the law’s constitutionality, claiming it was too broadly written.

The Texas court’s decision reaffirms a common gray area in privacy law. So-called Peeping Tom statutes protect people from being photographed in bathrooms or dressing rooms, but the U.S. Supreme Court has upheld that people in public places have no reasonable expectation of privacy.

Although not having one’s undergarments photographed might seem like a “reasonable expectation” to most people, the matter is far from settled. Earlier this year, the Supreme Judicial Court of Massachusetts threw out charges against a man caught taking upskirt photos of female passengers on public transportation. In that case, the court said existing state law simply did not protect clothed people in public areas from being photographed. Lawmakers responded by rushing an anti-upskirt law through the state Legislature, but its constitutionality has yet to be tested.