By Newley Purnell and Jeff Horwitz

Facebook Inc.'s WhatsApp said it filed a lawsuit in India to stop new government rules that would require the company to trace users' encrypted messages, escalating a battle over online speech between American tech firms and the South Asian nation's ruling party.

The messaging service, by far the largest in India, said in a statement that it filed the suit late Tuesday with the New Delhi High Court. The company has argued that the new rules violate Indian law because tracing individuals' messages would violate their fundamental right to privacy.

WhatsApp's suit comes as a 90-day grace period for compliance with strict new rules from India's Ministry of Electronics and Information Technology expires. Those rules grant the Indian government sweeping powers to remove content that undermines national security, public order and "decency or morality" and require communications platforms like WhatsApp to be able to trace content back to its creator. In the event that tech companies fail to promptly comply with the government requests, the law says, company employees in India can be held criminally liable.

India's government has come under fire from opposition groups for using such tactics to stifle online criticism over its handling of farmer protests and a surge in Covid-19 cases that has devastated the country in recent weeks.

In a statement on its website, WhatsApp said complying with the traceability requirement would force it to break the encryption used to protect communications between its users and "severely undermine" their privacy. Having to track and store such records would be technically inefficient, the company said, and could result in innocent people being investigated by law enforcement.

A government "that chooses to mandate traceability is effectively mandating a new form of mass surveillance," WhatsApp said in its statement.

A spokeswoman for India's Ministry of Electronics and Information Technology didn't immediately respond to a request for comment. In a forum in February, the ministry's senior director of cyber law denied that traceability would undermine user privacy and said it was necessary to track viral content back to its source.

The Wall Street Journal wasn't able to independently confirm the lawsuit with New Delhi's High Court.

Indian regulators issued long-mooted new rules governing tech platforms in February, saying that new powers were needed to counter a growing amount of illegal or incendiary online content.

In the months since, the Indian government has taken unprecedented steps to confront American tech firms. Last month, India's government ordered Twitter, Facebook and Instagram to block about 100 social media posts criticizing its handling of the Covid-19 outbreak, sparking public anger and allegations of censorship.

Indian police visited Twitter Inc.'s office in New Delhi on Monday to investigate the company's labeling of tweets from a ruling party spokesman as misleading.

In March, the Journal reported that India's government had threatened to jail employees of Twitter, Facebook and its WhatsApp unit in direct response to the companies' reluctance to comply with data and takedown requests. Internet freedom advocates have called the pressure unprecedented.

WhatsApp has more than 400 million users in India, more than any other country, and last year received permission to expand a digital payments service there.

Write to Newley Purnell at newley.purnell@wsj.com and Jeff Horwitz at Jeff.Horwitz@wsj.com

(END) Dow Jones Newswires

05-25-21 2353ET