A federal judge has struck down Idaho’s so-called “ag-gag” law that prohibited the recording of animal abuses on farms.

U.S. District Court Judge B. Lynn Winmill ruled (pdf) this week that the law—one of eight adopted in the country—was unconstitutional because it violated the First Amendment.

The legislature passed the law, which was drafted by the Idaho Dairymen’s Association, last year after an animal rights group, Mercy for Animals, produced an undercover video of the Dry Creek Dairy in Hansen that showed workers abusing cows. The video showed cows being dragged by tractors, workers jumping on cows and workers beating them.

Winmill tossed out the law, saying it criminalized all employment-based undercover investigations as well as investigative journalism, whistleblowing by employees, or “other expository efforts that entail images or sounds.” The judge in his ruling cited remarks made by lawmakers during the bill’s debate, including those by one senator who accused animal rights groups to resorting to “terrorism” and likening them to “marauding invaders centuries ago who swarmed into foreign territory and destroyed crops to starve foes into submission.”

Winmill even cited Upton Sinclair’s classic exposé, “The Jungle,” saying that if Sinclair had written that today in Idaho, he would be prosecuted.

Idaho’s attorney general’s office, which defended the law, had not decided if it will appeal the decision to the Ninth Circuit Court of Appeals in San Francisco.