(Bloomberg) -- A Florida law prohibiting social media platforms from suspending the accounts of political candidates was blocked by a federal judge just one day before it was set to take effect.

Likening the state’s law to “burning the house to roast a pig,” U.S. District Judge Robert R. Hinkle in Tallahassee said the legislation passed by a Republican legislature and a priority of Governor Ron DeSantis, violates the companies’ free speech rights.

DeSantis cited decisions by Facebook and Twitter to remove former President Donald Trump from their platforms in his support of the laws. The legislation attempts to “rein in social-media providers deemed too large and too liberal,” Hinkle wrote in his decision. “Balancing the exchange of ideas among private speakers is not a legitimate governmental interest.”

The lawsuit was filed in late May by two trade associations supported by social media companies against Florida’s attorney general and other state officials and agencies. Under the law, the companies face daily fines of $250,000 for blocking a statewide candidate for more than 14 days and $25,000 per day for suspending social media accounts of candidates in local elections.

The trade associations argued the law interferes with social media companies’ editorial judgment, and illegally compels and prohibits speech.

Matt Schruers, president of the Computer & Communications Industry Association, praised the judge’s ruling in a post on Twitter.

Florida Attorney General Ashley Moody’s office didn’t immediately return a call seeking comment.

In his support of the law, DeSantis had cited Twitter’s permanent suspension of Trump and YouTube’s removal of a panel the governor hosted with scientists who opposed masks and business closures during the pandemic. DeSantis has said companies such as Facebook, Twitter, Google, Amazon, and Apple wrongfully sought to squash criticism of coronavirus lockdowns.

Social-media providers sometimes bar users from platforms, Hinkle said, when they violate the companies’ standards by promoting fraud, “spreading a foreign government’s disinformation, inciting a riot or insurrection, providing false medical or public-health information, or attempting to entice minors for sexual encounters.”

The case is Netchoice v. Moody, 21-cv-220, U.S. District for the Northern District of Florida (Tallahassee)

©2021 Bloomberg L.P.