The Supreme Court upheld on Friday (Jan 17)a law banning TikTok in the United States on national security grounds if its Chinese parent company ByteDance does not sell it, putting the popular short-video app on track to go dark in just two days.

The court's 9-0 decision throws the social media platform - and its 170 million American users - into limbo, and its fate in the hands of Donald Trump, who has vowed to rescue TikTok after returning to the presidency on Monday.

The law was passed by an overwhelming bipartisan majority in Congress last year and signed by President Joe Biden, though a growing chorus of lawmakers who voted for it are now seeking to keep TikTok operating in the United States.

TikTok, ByteDance and some of the app's users challenged the law, but the Supreme Court decided that it did not violate the US Constitution's First Amendment protection against government abridgement of free speech as they had argued.

ByteDance has done little to divest of TikTok by the Sunday deadline set under the law. But the app's shutdown might be brief. Trump, who in 2020 had tried to ban TikTok, has said he plans to take action to save the app.

"My decision on TikTok will be made in the not too distant future, but I must have time to review the situation. Stay tuned!" Trump said in a social media post.

TikTok CEO Shou Zi Chew plans to attend Trump's second inauguration on Monday in Washington.

"I want to thank President Trump for his commitment to work with us to find a solution that keeps TikTok available in the United States," Chew said in a statement, while reiterating the company's free speech claims.

Trump said he and Chinese President Xi Jinping discussed issues including TikTok in a phone call on Friday.

It is possible that TikTok could keep operating on Sunday if the Biden administration clearly states it will not enforce the law in deference to the incoming Trump administration.

However, it is not clear if that would convince Apple, Alphabet's Google, Oracle and others not to stop providing key services to TikTok.

A person briefed on the matter said TikTok is still planning to go dark on Sunday without further clarity from the Biden administration on the legal status of the app.