A federal judge in Louisiana blocked a state law on Tuesday that would have required the display of the Ten Commandments in every public school classroom. The legislation, passed by state lawmakers this year, has been closely watched, because Louisiana was the first state to enact this kind of mandate in more than 40 years.

The decision was a setback for supporters of the measure, but not an unexpected one: Proponents have braced themselves for pushback and, in many ways, have invited a lengthy legal fight, as part of a larger effort by conservative Christian groups to amplify public expressions of faith.

John W. deGravelles, a U.S. District Court judge appointed to the bench by President Barack Obama, found that the law, which was scheduled to take effect Jan. 1, was unconstitutional. He forbade the state from enforcing it.

In his decision, deGravelles wrote that the law was “coercive to students, and, for all practical purposes, they cannot opt out of viewing the Ten Commandments when they are displayed in every classroom, every day of the year, every year of their education.”

He added: “There are any number of ways that the state could advance an alleged interest in educating students about the Ten Commandments that would be less burdensome.”

Attorney General Liz Murrill of Louisiana, a Republican, said in a statement that she strongly disagreed with the judge’s decision and would immediately appeal it. Supporters of the bill expect a friendlier reception from the appeals court, the 5th U.S. Circuit Court of Appeals, which is considered to be one of the nation’s most conservative courts.

The measure in Louisiana requires that posters containing the Commandments be displayed in each classroom of every public elementary, middle and high school in the state, as well as in classrooms at public colleges.

Supporters have argued that the Ten Commandments were not merely a religious text, but also a historical document, laying out the guidelines that have underpinned the modern legal system.

The legal challenge to the law was brought by nine families with children in Louisiana public schools, including at least two Unitarian Universalist families, a Jewish family, an atheist family, a Presbyterian family and some nonreligious families.