The US Senate has passed legislation that would force TikTok’s China-based parent company to sell the social media platform under the threat of a ban.

It is a contentious move by US lawmakers that is expected to face legal challenges and disrupt the lives of content creators who rely on the short-form video app for income.

The TikTok legislation was included as part of a larger 95 billion dollar (£76 billion) package that provides foreign aid to Ukraine and Israel and was passed 79-18.

It now goes to President Joe Biden, who said in a statement immediately after passage that he will sign it on Wednesday.

A decision made by House Republicans last week to attach the TikTok bill to the high-priority package helped expedite its passage in Congress and came after negotiations with the Senate, where an earlier version of the Bill had stalled.

Canada Schools- Social Media Lawsuit
It is a contentious move by US lawmakers that is expected to face legal challenges (Damian Dovarganes/AP, File)

That version had given TikTok’s parent company, ByteDance, six months to divest its stakes in the platform. But it drew scepticism from some key lawmakers concerned it was too short of a window for a complex deal that could be worth tens of billions of dollars.

The revised legislation extends the deadline, giving ByteDance nine months to sell TikTok, and a possible three-month extension if a sale is in progress.

The Bill would also bar the company from controlling TikTok’s secret sauce: the algorithm that feeds users videos based on their interests and has made the platform a trendsetting phenomenon.

TikTok did not immediately return a request for comment Tuesday night.

The passage of the legislation is a culmination of long-held bipartisan fears in Washington over Chinese threats and the ownership of TikTok, which is used by 170 million Americans.

For years, lawmakers and administration officials have expressed concerns that Chinese authorities could force ByteDance to hand over US user data, or influence Americans by suppressing or promoting certain content on TikTok.

“Congress is not acting to punish ByteDance, TikTok or any other individual company,” Senate Commerce Committee chairwoman Maria Cantwell said.

“Congress is acting to prevent foreign adversaries from conducting espionage, surveillance, maligned operations, harming vulnerable Americans, our servicemen and women, and our US government personnel.”

Opponents of the Bill say the Chinese government could easily get information on Americans in other ways, including through commercial data brokers that traffic in personal information.

The foreign aid package includes a provision that makes it illegal for data brokers to sell or rent “personally identifiable sensitive data” to North Korea, China, Russia, Iran or entities in those countries.

But it has encountered some pushback, including from the American Civil Liberties Union, which says the language is written too broadly and could sweep in journalists and others who publish personal information.

Many opponents of the TikTok measure argue the best way to protect US consumers is through implementing a comprehensive federal data privacy law that targets all companies regardless of their origin.

They also note the US has not provided public evidence that shows TikTok sharing US user information with Chinese authorities, or that Chinese officials have ever tinkered with its algorithm.

“Banning TikTok would be an extraordinary step that requires extraordinary justification,” said Becca Branum, a deputy director at the Washington-based Centre for Democracy & Technology, which advocates for digital rights.

“Extending the divestiture deadline neither justifies the urgency of the threat to the public nor addresses the legislation’s fundamental constitutional flaws.”

Congress TikTok
A man carries a Free TikTok sign in front of the courthouse where the hush-money trial of Donald Trump got underway on April 15 in New York (Ted Shaffrey/AP, File)

Senator Ron Wyden, a Democrat who voted for the legislation, said he has concerns about TikTok, but he has also worried the Bill could have negative effects on free speech, does not do enough to protect consumer privacy and could potentially be abused by a future administration to violate First Amendment rights.

“I plan to watchdog how this legislation is implemented,” Mr Wyden said in a statement.

China has previously said it would oppose a forced sale of TikTok, and has signalled its opposition this time around. TikTok, which has long denied it is a security threat, is also preparing a lawsuit to block the legislation.

“At the stage that the Bill is signed, we will move to the courts for a legal challenge,” Michael Beckerman, TikTok’s head of public policy for the Americas, wrote in a memo sent to employees on Saturday and obtained by The Associated Press (AP).

“This is the beginning, not the end of this long process.”

The company has seen some success with court challenges in the past, but it has never sought to prevent federal legislation from going into effect.

In November, a federal judge blocked a Montana law that would ban TikTok use across the state after the company and five content creators who use the platform sued.

Three years before that, federal courts blocked an executive order issued by then-president Donald Trump to ban TikTok after the company sued on the grounds that the order violated free speech and due process rights.

The Trump administration then brokered a deal that had US corporations Oracle and Walmart take a large stake in TikTok. But the sale never went through.

Mr Trump, who is running for president again this year, now says he opposes the potential ban.

Since then, TikTok has been in negotiations about its future with the secretive Committee on Foreign Investment in the United States, a little-known government agency tasked with investigating corporate deals for national security concerns.

On Sunday, Erich Andersen, a top attorney for ByteDance who led talks with the US government for years, told his team that he was stepping down from his role.

“As I started to reflect some months ago on the stresses of the last few years and the new generation of challenges that lie ahead, I decided that the time was right to pass the baton to a new leader,” Mr Andersen wrote in an internal memo that was obtained by the AP.

He said the decision to step down was entirely his and was decided months ago in a discussion with the company’s senior leaders.

Meanwhile, TikTok content creators who rely on the app have been trying to make their voices heard. Earlier on Tuesday, some creators congregated in front the Capitol building to speak out against the Bill and carry signs that read “I’m 1 of the 170 million Americans on TikTok”, among other things.

Tiffany Cianci, a content creator who has more than 140,000 followers on the platform and had encouraged people to show up, said she spent Monday night picking up creators from airports in the DC area.

Some came from as far as Nevada and California. Others drove overnight from South Carolina or took a bus from upstate New York.

“If our data is not safe on TikTok, I would ask why the president is on TikTok,” she said.