A federal judge has blocked President Trump's executive order that would have effectively shut down popular Chinese app WeChat, ruling that the action represents a free speech violation.

WeChat, used by 1.2 billion users worldwide and 19 million people in the U.S., was set to stop operating in the U.S. on midnight Sunday following Trump's order invoking a national emergency and targeting the app on national security grounds.

But U.S. Magistrate Judge Laurel Beeler in Northern California issued a preliminary injunction Sunday morning siding with users of WeChat, who claimed in a lawsuit that Trump's action curbed their First Amendment rights.

"Certainly the government's overarching national-security interest is significant," Beeler wrote, but the Trump administration "has put in scant evidence that its effective ban of WeChat for all U.S. users addresses those concerns," the judge wrote.

The reprieve for WeChat comes a day after TikTok, an app owned by ByteDance, a company based in China, was rescued in a last-minute deal approved by Trump in which software company Oracle will serve as a custodian of U.S. user data, with a major investment from Walmart.

While TikTok is primarily used for creating and sharing short, goofy videos among mostly teens and 20-somethings, WeChat is like several different apps combined into one. It is communications and social media platform, and for some the primary way of staying in touch with family in China. Users on WeChat also use the app to purchase flights, read the news and transfer money.

"WeChat is effectively the only means of communication for many in the community, not only because China bans other apps, but also because Chinese speakers with limited English proficiency have no options other than WeChat," Beeler wrote in her order, comparing WeChat to "a virtual public square for the Chinese-speaking and Chinese-American community."

The lawsuit was filed by the U.S. WeChat Users Alliance, a nonprofit representing the interests of U.S. WeChat users that was established to challenge Trump's order.

In the suit, lawyers pointed to the president's numerous anti-China statements made before he issued the order against WeChat, including Trump's use of the phrase "the China virus," and "Kung-Flu" to describe the coronavirus.

Thomas Burke, a lawyer representing the WeChat users, told NPR he is grateful the order was temporarily stopped.

"Never before has a President sought to ban an entire social media platform – used by a minority community to communicate – with such discriminatory animus and haste," Burke said.

WeChat is owned by Chinese tech company TenCent. The Trump administration insiststhat the app can be used by the Chinese government to harvest the data of Americans. White House officials also says WeChat censors content that the Chinese Communist Party disagrees with, arguing that the app can be used for disinformation campaigns.

In her order, Beller said while there is considerable evidence that some Chinese technologies do pose a legitimate national security threat to the United States, "the specific evidence about WeChat is modest," the judge wrote.

The Trump administration has not said whether it intends to appeal the order.

Copyright 2020 NPR. To see more, visit https://www.npr.org.