They are called “ag-gag” laws, statutes written to prevent crusading activists from using undercover techniques to expose pollution and animal cruelty in large-scale farming operations.

Such statutes have been introduced in a handful of states in recent years to protect agricultural businesses from increasingly aggressive efforts by environmental groups and animal rights organizations. The activists attempt to gain surreptitious access to production facilities, farms, and rangeland to videotape suspected violations or collect other evidence.

The supporting information is then turned over to government agencies and sometimes released to the public.

Undercover operations by animal rights groups have exposed abuses at a turkey farm in North Carolina; the whipping of cows in New Mexico; harsh conditions endured by laying hens in Iowa, Minnesota, and Colorado; and cruel treatment at a beef slaughterhouse in California, among others.

Agribusiness interests face a double threat from such investigatory efforts – enforcement actions by state and federal government agencies, and a potential backlash from consumers.

Sympathetic lawmakers have passed statutes that make it illegal for activists to gain unauthorized access to farming operations with the intent to document suspected abuses. At least 10 states have passed such laws.

Now this battle is moving to the courts in cases that pit the property rights of farmers and agribusiness against the free speech rights of activists.

At least so far, the activists are winning.

In August, a federal judge struck down an Idaho law that made it illegal for someone to enter an agricultural production facility without permission to make an audio or video recording of operations.

The judge said the law violated both the freedom of speech and equal protection by seeking to censor speech by undercover activists and whistleblowers concerning the safety of the public food supply.

Earlier this week, a federal judge ruled that a similar law in Wyoming was likely unconstitutional.

US District Judge Scott Skavdahl said he had “serious concerns and questions about the constitutionality of various provisions” of Wyoming’s so-called data trespass laws.

The Wyoming laws, passed in early 2015, seek to supplement the state’s existing trespass statute by making it illegal to trespass on open land and/or on private property with the intent to collect “resource data.”

State lawmakers had received complaints from ranchers about environmental activists who were repeatedly trespassing on their land to collect water samples to turn over to state and federal agencies that monitor water quality.

“In response, the legislature enacted two statutes designed to discourage, and if necessary penalize, such behavior,” according to a state brief filed in the case.

“In so doing,” the brief says, “the legislature acted to address an issue – trespass – that is inextricably intertwined with the economic and social welfare of the state.”

Lawyers for the state argued in court that the new laws helped advance a legitimate government interest in protecting private property. They said there is no First Amendment right to trespass.

Lawyers for the activist groups disagree. “When citizens discover and report violations of law or harm to the public’s interest, they exercise First Amendment rights central to the very idea of our democracy,” Justin Pidot, a law professor at University of Denver, argued in his brief to the court.

“Except in the most extreme circumstances, the government may not punish those who ask it to take action against illegal or harmful activities without violating those fundamental principles of liberty and justice,” Mr. Pidot added.

One of the Wyoming statutes provides criminal penalties, including up to a year in prison and $1,000 fine. A civil version of the statute permits a property owner or someone who is leasing the land to sue a trespasser for all related economic damages resulting from the trespass, and litigation costs.

In his order this week, Judge Skavdahl rejected a request by state lawyers to dismiss the activists’ lawsuit. Instead, the judge said the activist groups had raised legitimate constitutional issues – including a claim that the law was aimed at facilitating unconstitutional censorship.

Skavdahl said the civil statute “appears to simply be a façade for content or viewpoint discrimination” that is meant to suppress activist speech about agri-business practices potentially harmful to the public.

Laws that disfavor specific kinds of speech are generally struck down as unconstitutional unless they can be justified by a compelling government interest.

The judge added that the statute sought to bar people from collecting resource data on public lands and reporting it to government agencies, even though members of the public are entitled to enter public lands for other reasons.

Lawyers for Wyoming have said that they have no comment, given that the case is ongoing.

Lawyers for the activist groups praised the judge’s action.

“The court’s order dispels the myth that Wyoming was attempting to create that its laws intend to protect private property rather than silence the voices of those concerned about the environment and animal welfare,” Pidot said in a statement.

“I am optimistic that when the court reaches its ultimate conclusion, it will understand that such censorship is entirely inconsistent with the First Amendment,” Pidot added.

“Americans have a First Amendment right to expose illegal activities and cruelty to animals,” said Jeff Kerr, general counsel at People for the Ethical Treatment of Animals (PETA), one of the activist groups supporting the lawsuit.

The other groups in the lawsuit are: Western Watersheds Project, National Press Photographers Association, Natural Resources Defense Council, the Center for Food Safety, and the Animal Legal Defense Fund.

The case is Western Watersheds Project v. Peter Michael (15CV169). The case has not yet been set for trial.