CNN Business  — 

A federal judge on Wednesday temporarily blocked a new Florida law regulating how social media companies can moderate content, saying hours before the law was set to take effect that the legislation violates the First Amendment and contradicts federal law.

The preliminary injunction is a victory for Silicon Valley and a setback for conservatives in Florida’s government who had advocated for the measure as a way to rein in Big Tech’s alleged liberal agenda. But the decision could also further energize Republicans in Congress to push new legislation on content moderation at the federal level.

The Florida law, signed in May by Gov. Ron DeSantis, would have gone into effect Thursday. It would have barred online platforms from suspending politicians and allowed politicians to sue tech companies for having been removed from social media. It would also have restricted companies accused of antitrust violations from doing business with the state government.

The hot button bill was one of the most severe steps taken by a Republican governor to address allegations of censorship by the online platforms. In signing the legislation, DeSantis and his allies said the measures were necessary to preserve the freedom of speech of conservatives against “Big Tech oligarchs.”

But the legislation is unconstitutional because it infringes on tech companies’ First Amendment speech rights, said Judge Robert Hinkle of the US District Court for the Northern District of Florida.

The government cannot force private companies to make certain editorial judgments, he said, and if the law were to go forward, it would be an example of the kind of government-compelled speech prohibited by a range of prior cases. Hinkle also took issue with the broadness of the law.

“These statutes are not narrowly tailored,” Hinkle wrote. “Like prior First Amendment restrictions, this is an instance of burning the house to roast a pig.”

Christina Pushaw, DeSantis’s press secretary, said in a statement that the governor’s office is “disappointed” by the ruling and they “plan to immediately appeal” the decision.

Though the ongoing litigation could still result in the law being upheld, Hinkle said he was issuing the preliminary injunction in part because the plaintiffs — two tech industry trade groups who sued in May — were likely to succeed on the merits of their legal challenge.

Hinkle added that the law also appears to conflict with Section 230 of the Communications Act of 1934 — a federal law that provides immunity to websites for much of the content posted by their users.

Section 230 has been criticized for giving tech companies an easy escape hatch from content moderation lawsuits. Nevertheless, Hinkle wrote, Section 230 plainly preempts state laws like Florida’s that try to create new areas of liability for tech companies over online content.

A provision of the Florida law that exempted theme park operators also raised an “obvious constitutional issue,” Hinkle said. The legislation establishes carveouts that critics said give companies such as Comcast and Disney, who maintain theme parks as well as websites otherwise covered under the law, a free pass.

The tech trade groups that filed the suit had objected to those provisions as discriminatory. Hinkle agreed, saying state lawmakers charged ahead with regulating a vast range of businesses but were “apparently unwilling to subject favored Florida businesses to the statutes’ onerous regulatory burdens.”