(Bloomberg) -- Montana’s ban of TikTok was blocked by a federal judge in a closely watched challenge to the first statewide measure prohibiting the general public from using the wildly popular app.

TikTok argued that the ban, which aimed to bar residents from downloading the app beginning next year, would trample free-speech rights based on a misguided view that Chinese ownership of the platform poses a national security threat.

With a law enacted in May, Montana became the first state to completely bar TikTok’s operations after targeted bans focusing on government devices and networks cascaded across the country last year. The European Union, the UK, Canada and a handful of other nations have imposed similar restrictions.

The bans pit concerns about privacy and national security against personal freedoms. A 2022 Pew Research Center survey found that two-thirds of American teens were using TikTok every day, with 16% saying they were on the platform almost constantly. 

Thursday’s ruling halts the Montana measure — known as SB 419 — from taking effect Jan. 1 while the legal challenge plays out. 

“Despite the state’s attempt to defend SB 419 as a consumer protection bill, the current record leaves little doubt that Montana’s legislature and Attorney General were more interested in targeting China’s ostensible role in TikTok than with protecting Montana consumers,” US District Judge Donald Molloy wrote.

A TikTok spokesperson hailed the ruling.

“We are pleased the judge rejected this unconstitutional law and hundreds of thousands of Montanans can continue to express themselves, earn a living, and find community on TikTok,” the spokesperson said in an email.

TikTok Ban in Montana Seen by Judge as Out of Step With US

A lawyer arguing for Montana Attorney General Austin Knudsen said during an October hearing that the state had provided ample evidence of the need to ban TikTok, which is owned by China-based ByteDance Ltd.

Knudsen’s office argued it was illogical for TikTok to claim that Montana lacks evidence of its link to China, and to assert that the state’s ban is pre-empted because the company has been negotiating with the federal government over China-related national security concerns.

“We look forward to presenting the complete legal argument to defend the law that protects Montanans from the Chinese Communist Party obtaining and using their data,” said Knudsen spokeswoman Emilee Cantrell in a statement.

The company’s legal challenge to the ban followed a suit filed by a group of TikTok content creators who said the Montana law violates the Constitution’s First Amendment and will disrupt their livelihoods. Ambika Kumar, a lawyer for the creators, celebrated Thursday’s decision and reiterated that they view the law as “unwarranted and unconstitutional.”

Molloy agreed that the First Amendment claims raised in the lawsuit are likely to succeed, because the ban “burdens substantially more speech than is necessary to fulfill even its purported interests.”

“The Legislature used an axe to solve its professed concerns when it should have used a constitutional scalpel,” he wrote.

Social Media Laws Backed by GOP Draw US Supreme Court Scrutiny

The ruling isn’t Molloy’s final word on the case, but reflects his judgment that TikTok will probably prevail on the merits of its case.

Molloy acknowledged that his order comes as “courts across the country grapple with government regulation of large social media companies.”

He pointed to two cases before the US Supreme Court challenging the constitutionality of laws passed in Florida and Texas that would restrict how social media companies control content posted on their websites.

The case is TikTok Inc. v. Knudsen, 23-cv-00056, US District Court, District of Montana (Missoula).

(Updates with statement from Knudsen spokeswoman)

©2023 Bloomberg L.P.