RICHMOND, Va. (AP)  Students” freedom of expression and due process are put at risk by a South Carolina law that led to the arrest of two high school students for videotaping a classmate being flipped out of a chair, a federal appeals court says.

In a ruling issued Thursday, the Fourth U.S. Circuit Court of Appeals vacated a District Court decision and sent the case back for further action. The appeals court found the “disturbing schools” law was applied disproportionately toward black students as well as those who are disabled.

“The court has sent a clear message: rather than funnel children into the criminal justice system over minutiae and lawful activities, schools must recognize and protect students” rights,” Sarah Hager, staff attorney with the American Civil Liberties Union”s Racial Justice Program, said in a news release. “This message is particularly important in this time of student activism.”

In October 2015, a Richland County sheriff”s deputy arrested a Spring Valley High School student who refused to surrender her cellphone and leave a classroom. Two classmates videotaped Deputy Ben Fields flipping the teen out of her chair and tossing her across the room.

Both students who videotaped the incident were charged with disturbing schools.

Richland County Sheriff Leon Lott agreed in 2016 with the U.S. Justice Department that his department would do its part in ending what the federal agency described as a “school-to-prison pipeline.”

The ACLU sued South Carolina in federal court over what it called the criminalization of normal adolescent misbehavior. The lawsuit challenged the state”s “disturbing schools” and “disorderly conduct” charges as unconstitutionally vague.

Lott said at the time he agreed with the ACLU on the points it argued. He called the “disturbing schools” charge commonly used against students a “terrible law” that has been “misused and abused.”