(The Hill) — A divided federal appeals court panel ruled that a North Carolina law cannot be used to prevent People for the Ethical Treatment of Animals (PETA) from using undercover cameras.

In a 2-1 decision, the 4th U.S. Circuit Court of Appeals ruled on Thursday that blocking the animal rights group’s “newsgathering activities” would violate the First Amendment’s free speech protections.

North Carolina’s Property Protection Act prohibits employees from placing unattended cameras on their employer’s premises, among other provisions.

“We enjoin the Act insofar as it applies to bar protected newsgathering activities PETA wishes to conduct. But we leave for another day all other applications of the Act,” wrote Judge Albert Diaz, who was nominated by former President Obama.

Judge Henry Floyd, a fellow Obama appointee, joined Diaz’s opinion. Judge Allison Rushing, who was nominated by former President Trump, dissented.

PETA, which regularly conducts undercover animal-cruelty investigations and publishes what it uncovers, argued the law was a discriminatory speech restriction disguised as a property protection law.

“If PETA’s actions truly violate some lawful prohibition (like trespass), PETA may be charged for that violation,” the court ruled. “What North Carolina may not do, however, is craft a law targeting PETA’s protected right to speak.”

North Carolina contended the entire law passed constitutional muster and that undercover investigations in nonpublic areas are unprotected speech.

“That is a dangerous proposition that would wipe the Constitution’s most treasured protections from large tranches of our daily lives,” the court ruled. “Fortunately, it has no basis in law.”