President Donald Trump’s ban on TikTok was temporarily blocked by a federal judge, dealing a blow to the government in its showdown with the popular Chinese-owned app that it says threatens national security. After an unusual Sunday morning hearing, US District Judge Carl Nichols granted a preliminary injunction against the ban on new downloads of the video-sharing network, which would have gone into effect at 11.59pm in Washington. The judge declined to grant an injunction on a separate set of prohibitions scheduled for November 12 that are designed to further curb the app’s use in the US. TikTok’s owner, ByteDance, requested the hold after the president ordered the app out of American stores unless the company sold a stake in its US operations to a domestic buyer. The ban would have removed TikTok from stores run by Apple and Google’s Android, the most widely used marketplaces for apps. People who don’t yet have the app wouldn’t have been able to get it, and those who already have it wouldn’t have access to updates needed to ensure its safe and smooth operation. TikTok has been downloaded by more than 100 million Americans. “We’re pleased that the court agreed with our legal arguments and issued an injunction preventing the implementation of the TikTok app ban,” the company said in a statement. “We will continue defending our rights for the benefit of our community and employees. At the same time, we will also maintain our ongoing dialogue with the government to turn our proposal, which the President gave his preliminary approval to last weekend, into an agreement.” It’s the second legal ruling against the Trump administration’s efforts to crack down on popular apps with Chinese owners. Mr Trump has called for bans on both TikTok and WeChat, owned by China’s Tencent Holdings, arguing that the apps could give China’s government access to millions of Americans’ personal data. WeChat users won a court injunction against a ban last week. The bans are part of an increasingly hard line Mr Trump has taken on Beijing as the election approaches. The TikTok order was issued with a sealed opinion, so the reasons for the judge’s ruling weren’t immediately available. The judge asked both parties to submit filings by 11am on Monday to say whether the opinion should be unsealed. The government submitted sealed papers on Friday that it said contained “confidential business information”, but much of that filing was later released with minor redactions. The judge also ordered both parties to submit a joint proposed schedule for further hearings “on or before” September 30. “The government will comply with the injunction and has taken immediate steps to do so, but intends to vigorously defend the E.O. and the secretary’s implementation efforts from legal challenges,” the Commerce Department said in a statement, referring to the president’s executive order. A Treasury Department spokeswoman noted that the November sale deadline remains in effect. If the government chooses to appeal the decision, it would go to the US Court of Appeals for the District of Columbia Circuit, one level below the Supreme Court. ByteDance is fighting the Trump administration in court even as it pursues its approval for the sale of a stake in the US business to Oracle and Walmart. The ruling on Sunday doesn’t effect a November 12 deadline for the sale. A lawyer for TikTok told the judge at Sunday’s virtual hearing that the ban was irrational given that ByteDance is in talks to strike a deal the president himself has demanded. “How does it make sense to impose this app-store ban tonight when there are negotiations underway that might make it unnecessary?” attorney John Hall asked. Even as the sale of TikTok is still awaiting final US approvals, two of China’s most prominent state-backed media outlets last week denounced the deal. "What the US has done to TikTok is almost the same as a gangster forcing an unreasonable and unfair business deal on a legitimate company," the state-run <em>China Daily</em> wrote in a Wednesday opinion piece. Hu Xijin, the influential editor-in-chief of the Party-run <em>Global Times</em>, tweeted that Beijing likely wouldn't approve the current agreement as it endangered China's national security. The Chinese Foreign Ministry in Beijing didn’t immediately respond Monday to a request for comment on the court decision. TikTok’s lawyer told the judge Sunday that banning it from US app stores would undermine security by preventing existing users from receiving weekly security updates. He argued that the government has less burdensome alternatives, such as the sale, to achieve its national-security aims. ByteDance says Mr Trump is exceeding his authority with the ban. “The consequences immediately are grave,” Mr Hall told the judge. “It would be no different than the government locking the doors to a public forum, roping off that town square.” His language echoed the ruling of a judge in California who put a hold on Mr Trump’s WeChat ban last week, citing its effect on free speech and the irreparable harm that the ban would cause to the business. At the hearing Sunday, Daniel Schwei, a lawyer for the Justice Department, countered that “the concern here is about data security risk and leaving data vulnerable to the Chinese government. It is a threat today, it is a risk today, and therefore it deserves to be addressed today”. The US government decided last week to extend its deadline to allow for more sale discussions. In a filing on Friday, the US cited FBI director Christopher Wray’s assessment that China poses the “greatest long-term threat to our nation’s information and intellectual property”. TikTok is “challenging a national security determination by the president as well as the judgment of the secretary of commerce about what’s necessary to mitigate those national security harms”, Mr Schwei told the judge. “And I think the court owes significant deference to that.”