A california judge has temporarily blocked an us department of commerce ban on chinese social media app wechat just hours before it was due to be implemented, dealing a blow to donald trumps efforts to curb use of the app due to security concerns.

Judge laurel beeler of the northern district of california granted a nationwide injunction on sunday suspending the order for apple and google to remove wechat, which is owned by chinese technology group tencent, from their app stores.the order had been due to come into force later in the day.

The plaintiffs, primarily a group called the us wechat users alliance, said in their lawsuit that the ban, which would have made the app essentially unusable in the us, violated first amendment-protected freedoms of speech, especially for chinese americans.

Judge beeler said that the plaintiffs have shown serious questions going to the merits of the first amendment claim, adding that the balance of hardships tips in the plaintiffs favour.

Wechat is tencents flagship social media app with more than 1bn users, mostly in china. it combines messaging, online payments, news articles and host of other functions in a single platform and is a primary tool of communication for many ethnic chinese people in the us.

The setback to the trump administrations efforts to curb the use of wechat due to national security concerns comes during intense negotiations over the fate of chinese-owned video app tiktok.on saturday the us president gave his blessing to tiktok-owner bytedances deal with oracle to keep the app operating in the us and the commerce department delayed an order to remove tiktok from apple and googles us app stores to september 27.

A senior commerce department official on friday said that the administration was prepared for whatever comes our direction in terms of legal challenges to the ban on wechat.

We put these together with a very clear mandate to protect first amendment rights, the official said.

We are not attempting to censor speech. in fact, its the exact opposite, the official added. one of the reasons that we are taking aim at these applications is that theyre being used by the chinese government to censor speech. so any claim that this is an attempt to limit ones freedom of speech [in the us] is, i think, challengeable.

Judge beelers injunction stated that while the government had established that chinas activities raised significant national-security concerns, it has put in scant little evidence that its effective ban of wechat for all us users addresses those concerns.

Michael bien, co-counsel for the plaintiffs, alleged in a statement that the ordered wechat ban had already caused irreparable harm to our clients.

The united states has never shut down a major platform for communications, not even during war times, he said.