DarcyMaulsby via Getty Images A hog farm in Iowa. On Wednesday, a federal judge struck down a law in the state that made it illegal for someone to take a job at a livestock operation to conduct an animal cruelty investigation.

DES MOINES, Iowa (AP) — A federal judge on Wednesday struck down an Iowa law that made it illegal to get a job at a livestock farm to conduct an animal cruelty undercover investigation, finding the law violated the constitutional right to free speech.

U.S. District Court Judge James Gritzner sided with opponents of the 2012 law that was intended to stop organizations like People for the Ethical Treatment of Animals from doing animal abuse investigations at farms and puppy mills. Iowa lawmakers approved the measure, which threatened up to a year in jail to those who conducted an undercover operation, after several high-profile cases in which animal welfare advocates recorded questionable animal treatment and then publicized the images through the media.

Rita Bettis Austen, legal director for the ACLU of Iowa, called the ruling “an important victory for free speech” and argued the so-called ag-gag law was an example of government using its power to protect those with power. The ACLU joined with animal welfare, food safety and open government advocates in the lawsuit, filed in 2017 in U.S. District Court in Des Moines.

“Ag gag clearly is a violation of Iowans’ First Amendment rights to free speech,” Bettis said in a statement. “It has effectively silenced advocates and ensured that animal cruelty, unsafe food safety practices, environmental hazards, and inhumane working conditions go unreported for years.”

The Animal Legal Defense Fund, which joined in the lawsuit, noted no undercover investigations had taken place in Iowa since the law was approved in 2012.

“Ag-Gag laws are a pernicious attempt by animal exploitation industries to hide some of the worst forms of animal abuse in the United States,” Animal Legal Defense Fund Executive Director Stephen Wells said in a statement.

In a win for free speech and animal protection, the U.S. District Court for the Southern District of Iowa struck down the state's Ag-Gag law, holding the ban on undercover investigations at factory farms and slaughterhouses violates the First Amendment https://t.co/SjAS02uGQr — ALDF (@ALDF) January 9, 2019

Federal courts have struck down similar laws in Idaho, Utah and Wyoming. Litigation is ongoing in North Carolina.

A spokesman for the Iowa attorney general’s office, which represented the state, says an appeal is under consideration.

The Iowa Pork Producers Association supported the law and expressed disappointment at the judge’s ruling.

“Iowa pig farmers will continue to properly care for their animals and provide safe and secure working conditions for their employees. And, they will fight those who try to destroy or attack their livelihoods one case at a time,” the organization said in a statement.

___

Associated Press writer Scott McFetridge contributed to this report.