The U.S. government and TikTok went head-to-head in federal court Monday as oral arguments began in a consequential legal case that will determine whether — or how — a popular social media platform used by nearly half of all Americans will continue to operate in the country.

Attorneys for the two sides appeared before a panel of judges at the federal appeals court in Washington. TikTok and its China-based parent, ByteDance, are challenging a U.S. law that requires them to break ties or face a ban in the U.S. by mid-January.

The law, signed by President Joe Biden in April, was a culmination of a yearslong saga in Washington over the short-form video-sharing app, which the government sees as a national security threat due to its connections to China. But TikTok says the law runs afoul of the First Amendment.

In court documents submitted over the summer, the Justice Department emphasized the government’s two primary concerns. First, TikTok collects vast swaths of user data, including sensitive information on viewing habits, that could fall into the hands of the Chinese government through coercion. Second, the U.S. says the proprietary algorithm that fuels what users see on the app is vulnerable to manipulation by Chinese authorities, who can use it to shape content on the platform in a way that’s difficult to detect.

TikTok has repeatedly said it does not share U.S. user data with the Chinese government.

In court documents, attorneys for TikTok and its parent company have also argued that divestment is not possible and that the app would have to shut down by Jan. 19 if the courts don’t step in to block the law.