Confused and frustrated people tore out enough hair to fill a ten-gallon hat when the Texas Court of Criminal Appeals ruled that a statute banning “improper photography,” such as taking sketchy shots of children in bathing suits who have no idea they are being photographed, was unconstitutional this week. The WTF reactions went beyond the Lone Star State with national news sites wondering how it was possible that such a blatant personal violation — and one that is a potential harbinger of child pornography — could have no legal ramifications?

Yet, with almost complete unanimity (only one of the nine judges dissented), the highest criminal court in Texas struck down the section of the improper photography law that forbids taking photographs in non-bathroom and non-dressing room spaces (essentially public spaces) under the following conditions:

— without the other person’s consent; and— with intent to arouse or gratify the sexual desire of any person

So, what was the problem? On the surface, the statute seems not only reasonable, but also obvious, especially when one considers the unsavory details of the case that spawned the ruling. In 2011, Ronald Thompson, was charged with 26 counts of improper photography after parents complained he was taking photos of their children at a Sea World in San Antonio. Police subsequently discovered 73 photos of children in bathing suits focusing on their breasts and buttocks. Thompson’s actions were nothing short of repulsive and disturbing.

Yet, Thompson ultimately walked away a free man because the court ruled the provision under which he was charged violated the First Amendment. That section of the law, the judges felt, marked a constitutional overreach because it granted the government the power to effectively police citizens’ dirty thoughts. “Banning otherwise protected expression on the basis that it produces sexual arousal or gratification is the regulation of protected thought, and such a regulation is outside of the government’s power,” the ruling stated. The wording of the section was such that, the judges argued, the law “could easily be applied to an entertainment reporter who takes a photograph of an attractive celebrity on the street.”

It is evident in the ruling that fears of potentially sweeping First Amendment violations drove the ruling, which is painfully ironic considering presiding Judge Sharon Keller’s disregard for other individual rights. Keller earned the nickname “Sharon Killer” for effectively blocking the stay of an execution in 2007 by refusing to let her court remain open past 5 p.m. Apparently, Keller’s rigidly lethal punctuality is tempered by her generous view of freedom of expression.

Despite Keller’s own questionable and disturbing record, her concerns about the statute’s wording are hardly outrageous. In an attempt to protect citizens from unwanted and inappropriate sexualization, Texas passed a law that hinges on determining whether someone took photos with the intention of providing themselves with sexual pleasure regardless of how physically invasive the photos are or the photographer is in taken them. Quoting a previous case, Keller wrote that the statute would allow the government to potentially take a “paternalistic interest in regulating the defendant’s mind.” While “paternalistic” may not have been the wisest choice of words considering the highly disturbing behavior Thompson showed toward children, the decision was about the statute itself, not condoning Thompson’s acts.

The ruling demonstrates the significant difficulties in creating effective legislation against acts that appear to clearly violate individuals’ right to privacy. Improper photography, upskirt shots (which is actually different from this Texas case), and revenge porn all fall into legal grey zones in many states, despite ample examples of sinister cases that warrant legal punishment.

Earlier this year, Massachusetts’ highest court acquitted an even more invasive photographer due to a poorly worded statute. Michael Robertson allegedly videotaped and photographed up the skirts of female passengers who sat across from him on public trolleys, but he got off the hook because the law stated the photos had to be naked or partially naked people. “A female passenger on a MBTA trolley who is wearing a skirt, dress, or the like covering these parts of her body is not a person who is ‘partially nude,’ no matter what is or is not underneath the skirt by way of underwear or other clothing,” the ruling stated. While Robertson’s actions may have very well violated the spirit of the law, they didn’t fit the language of it. Two days after the ruling, Gov. Deval Patrick signed a specific upskirt ban into law, but it didn’t change the fact that Robertson got away with an act that intuitively seems like a crime.

As states increasingly attempt to pass revenge porn legislation and launch suits against revenge porn sites, First Amendment concerns have reared their ugly, constitutional head.

While revenge porn is clearly wrong and an unforgivable violation of an individual’s privacy, it can be difficult to effectively legislate against it — and not because a bunch of wingnut perverts are standing in its way. “The reality is that revenge porn laws tend to criminalize the sharing of nude images that people lawfully own,” Lee Rowland of the American Civil Liberties Union told NPR. “That treads on very thin ice constitutionally.”

It is disappointing and, frankly, frightening that Thompson walked away from his repugnant Sea World excursion scot-free. Hopefully, Texas will take its cue from Massachusetts with its immediate passage of new upskirt ban or from California, which revised its initial revenge pan to include more types of photos. Constitutional concerns shouldn’t be a discouraging force; they should drive us to create stronger laws.