The U.S. Supreme Court on Friday ruled in favor of a group of parents who challenged a Maryland school district’s decision to include LGBTQ-themed books in elementary classrooms without offering an opt-out option, siding with claims that the policy violated religious freedom.

In a 6-3 decision, the court found that the Montgomery County Board of Education infringed on the parents’ First Amendment rights by refusing to accommodate religious objections to the curriculum.

“The board's introduction of the 'LGBTQ+ inclusive' storybooks, along with its decision to withhold opt-outs, places an unconstitutional burden on the parents' rights to the free exercise of their religion,” Justice Samuel Alito wrote in the majority opinion.

Alito added that requiring parents to expose their children to content that contradicts deeply held beliefs risks “undermining the religious beliefs and practices that the parents wish to instill.”

Justice Sonia Sotomayor, writing in dissent, warned that the ruling could create widespread confusion. “The result will be chaos for this nation's public schools,” she stated.