Idaho’s so-called “Ag-gag” law prevents recording devices from being brought on farms or into slaughterhouses without the owner’s consent. But now, a provision of that law was struck down by a three-judge appeals court panel.

The panel said in its decision that criminalizing the undercover videotaping violates the constitutional right to free speech. A DTN report says Idaho state lawmakers passed a bill in 2014 making it a crime to videotape feedlots, dairies, and other farming operations without the owner’s knowledge.

The Idaho dairy industry brought up the concerns after a 2012 undercover video surfaced, saying it damaged their business. Media outlets, civil rights groups, and animal activists sued the state, saying the law criminalized legitimate undercover journalism. The law requires anyone who violates it to pay restitution directly to the business.

A federal judge ruled the Idaho law was unconstitutional in 2015, which was then appealed. Court documents say the “panel held that the subsection criminalizing innocent behavior was staggeringly overbroad and that the purpose of the statute was, in large part, targeted at speech and investigative journalists.” Iowa, Utah, Missouri, Kansas, North Dakota, Montana, and North Carolina have similar ag-gag laws on their books. Court challenges to the law are underway in North Carolina and Utah.