DES MOINES, Iowa (CN) – Iowa’s so-called “ag-gag” law that makes it a crime for undercover journalists or animal-rights activists to investigate and report on animal abuse in livestock facilities is unconstitutional, a federal judge ruled Wednesday.

U.S. District Judge James Gritzner in Des Moines struck down the 2012 statute passed by the Iowa Legislature aimed at preventing reporters or activists from entering livestock facilities under false pretenses to report animal abuse.

“The law has the effect of criminalizing undercover investigations of certain agricultural facilities” including livestock confinements, egg production facilities, slaughterhouses and puppy mills, Gritzner wrote, ruling that it violated the First Amendment.

Iowa’s law was challenged in 2017 in federal court by the Animal Legal Defense Fund, Center for Food Safety, People for the Ethical Treatment of Animals and two Iowa-based groups represented by lead attorney Rita Bettis Austen, legal director of the American Civil Liberties Union of Iowa.

The suit named as defendants Iowa Governor Kimberly Reynolds, Attorney General Tom Miller and Montgomery County Attorney Bruce Swanson.

“Today’s decision is an important victory for free speech in Iowa, because it holds that Iowa’s ag-gag law on its face is a violation of the First Amendment,” Bettis Austen said in a statement.

“Ag gag clearly is a violation of Iowans’ First Amendment rights to free speech,” she added. “It has effectively silenced advocates and ensured that animal cruelty, unsafe food safety practices, environmental hazards, and inhumane working conditions go unreported for years. We are so pleased that with the court’s order today and that the law has finally been held to be unconstitutional.”

A spokesman for Miller said Wednesday the state attorney general is studying the ruling and will consider an appeal, but no decision had been made yet.

A request for comment from the office of Governor Reynolds was not immediately returned Wednesday afternoon.

Under the Iowa law, “agricultural production facility fraud” is committed by a person who willfully “obtains access to an agricultural production facility by false pretenses [or] makes a false statement or representation as part of an application or agreement to be employed at an agricultural production facility, if the person knows the statement to be false, and makes the statement with an intent to commit an act not authorized by the owner of the agricultural production facility, knowing that the act is not authorized.”

Iowa argued the statute punished conduct, not speech, and that false statements are not protected by the First Amendment.

The judge disagreed, saying one could not violate the statute without engaging in speech, and even false statements are protected by the First Amendment if they do not cause a “legally cognizable harm” or provide “material gain” to the speaker. False statements criminalized by Iowa’s statute do neither, he wrote.

Gritzner cited a litany of horribles reported from livestock operations: “For example, in 2011, an undercover investigation at Iowa Select Farms produced reports of workers hurling small piglets onto a concrete floor. Another investigation at Iowa’s Sparboe Farms, documented mistreatment of hens and chicks. And yet another, conducted by PETA, exposed workers at a Hormel Foods supplier in Iowa ‘beating pigs with metal rods,’ ‘sticking clothespins into pigs’ eyes and faces, and a supervisor kicking a young pig in the face, abdomen, and genitals to make her move while telling the investigator, ‘You gotta beat on the bitch. Make her cry.’”

The judge noted that PETA’s investigation was an “undercover, employment-based investigation in which the investigator also performed tasks assigned by the employer.”