A federal judge in Washington said he blocked the Trump administration’s proposed ban on the popular Chinese-owned TikTok app on Sunday because the U.S. government likely overstepped its authority.

In an opinion unsealed on Monday, U.S. District Judge Carl Nichols explained his reasoning for temporarily blocking a ban on new TikTok downloads that was set to go into effect Sunday night. TikTok owner ByteDance Ltd. would likely succeed in proving the Trump administration exceeded its legal authority under the emergency-powers law it invoked in announcing the ban, Nichols said.

Trump has argued that TikTok’s Chinese ownership makes it a threat to national security. In his ruling, Nichols said the government provided “ample evidence” that China is a national security threat, but that its evidence of the threat posed by TikTok “remains less substantial.”

While Nichols granted a preliminary injunction against the download ban, he declined to halt a separate set of prohibitions scheduled for Nov. 12 that are designed to further curb the app’s use in the U.S.

The judge’s reasoning for his Sunday ruling remained sealed until Monday because some of the government’s filings in the case contained confidential business information.

The ban would have removed TikTok from stores run by Apple Inc. and Google’s Android, the most widely used marketplaces for apps. People who didn’t yet have the app wouldn’t have been able to get it, and those who already had it wouldn’t have had access to updates needed to ensure its safe and smooth operation. TikTok has been downloaded by more than 100 million Americans.

In his opinion, Nichols said the ban would have done “irreparable harm” to TikTok, which has been growing at a rate of 424,000 new users a day in the U.S. “Barring TikTok from U.S. app stores would, of course, have the immediate and direct effect of halting the influx of new users, likely driving those users to alternative platforms and eroding TikTok’s competitive position,” Nichols wrote.

Nichols’ eleventh-hour ruling was the second time a judge has blocked the Trump administration’s efforts to crack down on popular apps with Chinese owners. Trump has called for bans on both TikTok and WeChat, owned by China’s Tencent Holdings Ltd., arguing that the apps could give China’s government access to the personal data of millions of Americans. WeChat users won a court injunction against a ban last week in federal court in California.

The ruling Sunday by Nichols provided a reprieve for TikTok, but it is not the end of the legal battle. TikTok still faces a Nov. 12 deadline to agree on a deal to sell its U.S. business to an American buyer, or face another set of prohibitions.

ByteDance is seeking government clearance to sell a stake of its U.S. business to Oracle Corp. and Walmart Inc. But while Trump has said he’s given the deal his “blessing,” the proposal requires formal approval from a government panel that oversees foreign investment in the U.S.

Comments are not available on this story.