DES MOINES — A federal court has ruled Iowa’s so-called “ag gag” law is unconstitutional.

The law set up a penalty for people who get a job on a farm or in a livestock confinement in order to go undercover to release details of the operation or free the animals. Rita Bettis Austen of the American Civil Liberties Union of Iowa says the law violated First Amendment rights.

“An especially grievous harm to our democracy occurs when the government uses the power of the criminal laws to target unpopular speech, to protect those with power,” she says, “and that’s exactly what this law was always about.”

Randy Evans, executive director of the Iowa Freedom of Information Council, says the court mentioned the value of undercover investigations.

“To allow and to prevent the state of Iowa from making a criminal action for entities that publish the truth,” he says, “that shine the spotlight on activities that are of deep interest to the citizens of the state of Iowa.”

Matthew Liebman, an attorney for the Animal Legal Defense Fund, says the law stifled investigations his clients might have conducted.

“They weren’t willing to put their investigators at risk of going to prison,” he says, “so now that this law is no longer an obstacle, I think we could expect to start seeing undercover investigations in Iowa.”

Governor Terry Branstad signed the law in 2012, saying it’s wrong for people to try to disrupt farming operations. Others who supported the law say people who enter livestock barns under false pretenses can expose the animals to diseases. Federal courts have struck down laws in Idaho, Utah and Wyoming that were — like Iowa’s law — intended to discourage groups like PETA from videotaping inside livestock confinements.