TikTok filed a lawsuit in federal court in the United States on Monday to prevent the state of Montana from outlawing the video-sharing software entirely.

TikTok said in the lawsuit that the unprecedented restriction, due to begin in 2024, infringes on the constitutionally guaranteed right to free speech.

"We anticipate our legal appeal will prevail based on an extremely strong set of precedents and facts," a TikTok spokeswoman told AFP.

On May 17, Montana Governor Greg Gianforte signed the historic prohibition into law.

Gianforte welcomed the restriction on Twitter to "protect Montanans' private and personal information to the Chinese Communist Party."

"The state implemented these unprecedented and unprecedented measures based on nothing else than unfounded speculation," TikTok claimed in the lawsuit.

Five TikTok users filed a lawsuit last week, requesting that a federal court overturn Montana's prohibition on the app, claiming it infringes their free speech rights.

Both lawsuits against Montana contend that the state is attempting to exercise national security powers that only the federal government possesses while also infringing free speech rights.

TikTok has asked the federal court to declare Montana's prohibition on its app illegal and to prevent the state from enforcing it.

"Montana cannot ban its residents from viewing or posting to TikTok any more than it can ban the Wall Street Journal from being published because of who owns it or the ideas it publishes," says the TikTok users' lawsuit.

The app is owned by the Chinese firm ByteDance, and it has been accused by a wide range of US politicians of being controlled by the Chinese government and used for spying by Beijing, something the company vehemently denies.

Montana became the first US state to outlaw TikTok, with the rule due to go into force next year as debate about the app's effects and security heats up.

- A legal issue -

The ban will act as a legal litmus test for a nationwide ban on the platform, which politicians in Washington are increasingly clamouring for.

According to Montana law, it is a violation whenever "a user accesses TikTok, is offered a chance to access TikTok, or is offered the opportunity to download TikTok."

Every infringement is penalized by a $10,000 fine per day it occurs.

According to the law, Apple and Google must remove TikTok from their app stores, and corporations may face daily fines.

The embargo will go into force in 2024, but it will be null and void if TikTok is acquired by a firm incorporated in a country not listed by the US as a foreign opponent, according to the law.

According to University of Richmond law professor Carl Tobias, the cases should go quickly in court because they rely on matters of law that don't require gathering a lot of evidence.

"There are very compelling legal arguments to support the plaintiffs," Tobias explained.

"First, there's free speech, and second, if the ban is justified by national security, that's a matter for the federal government, not any individual state."

The rule is the latest of clashes between TikTok and numerous Western governments, with the app already prohibited on government devices in the United States, Canada, and several European countries.