Most of a Florida law that sought to stop social media companies from restricting users' political speech violates the companies' free speech rights and cannot be enforced, a federal appeals court ruled on Monday, agreeing with a lower court.

However, a three-judge panel of the 11th U.S. Circuit Court of Appeals revived a part of the law requiring companies like Meta Platforms' Facebook, Alphabet Inc's Google and Twitter Inc to disclose the standards they use to moderate content on their platforms.

The unanimous decision was authored by Circuit Judge Kevin Newsom, who was appointed by Republican former President Donald Trump.

The 11th Circuit ruled that the parts of the law concerning political speech violated social media companies' First Amendment right to decide what to publish. However, it said requiring them to disclose their standards likely did not, ordering the lower court to reconsider that issue.

Bryan Griffin, a spokesperson for Florida Governor Ron DeSantis, called the decision "stupefying" and said the governor's office was considering appeal. DeSantis signed the law in May 2021.

NetChoice, an industry group including Facebook, Google and Twitter that had sued to challenge the law, noted the U.S. Constitution's protections when asked for comment.

"The First Amendment protects platforms and their right to moderate content as they see fit - and the government can't force them to host content they don't want," NetChoice Vice President Carl Szabo said in a statement.

DeSantis, a Republican, previously said the law was needed to prevent "censorship" by "Big Tech," pointing to Trump's removal by Twitter and Facebook in January 2021. The companies cited Trump's praise for his supporters who stormed the U.S. Capitol after he lost the 2020 presidential election as a reason for the bans.

The Florida law would fine social media companies that ban political candidates. A federal judge last June blocked the law from taking effect.

Another federal appeals court earlier this month upheld a Texas law prohibiting social media companies from banning users for their political views. NetChoice is asking the U.S. Supreme Court to block that law.