An attempt by Texas state authorities to block anti-Israel protests at night was rejected in a federal court ruling.

U.S. District Judge David Ezra ruled that the recently enacted Texas law constitutes an unconstitutional infringement on free speech.

The struck-down law allowed universities, including the University of Texas, to prohibit demonstrations and rallies between 10:00 p.m. and 8:00 a.m., restrict the use of loud music and speakers during the last two weeks of the semester, and ban the invitation of outside speakers.

The law also included limits on erecting tents, removing the U.S. flag or exchanging it with that of another country or organization, and covering faces to avoid identification or intimidate others. The proposal was presented as a tool to address a wave of protests against Israel on academic campuses.

Judge Ezra wrote in his ruling, “The First Amendment does not have a bedtime of 10:00 p.m. The burden is on the government to prove that its actions are narrowly tailored to achieve a compelling governmental interest. It has not done so.”

He added that the provision of the law requiring universities to act in accordance with the First Amendment “does not change the fact that the statute then requires universities to adopt policies that violate those very constitutional protections.”