WhatsApp has sued the Indian government in a bid to block new rules it says would lead to “mass surveillance” by forcing social media platforms to hand over private information about their users.

The company confirmed Wednesday that such a complaint has been filed with the Delhi High Court. CNN Business has asked for a copy of the lawsuit.

The lawsuit is an attempt to stave off strict rules that are supposed to take effect Wednesday. They include demands that companies create special roles in India to keep them in compliance with local law, and to stay in contact with law enforcement 24/7. There are also requirements that services remove some types of content, including posts that feature “full or partial nudity.”

But the rule that WhatsApp most takes issue with is one that would require companies to trace the “first originator” of messages if asked by authorities. The government has said that such requests would be made only in relation to serious crime, but the company is concerned that this move would effectively end any guarantee of user privacy by requiring the Facebook-owned platform to keep track of every message.

“Requiring messaging apps to ‘trace’ chats is the equivalent of asking us to keep a fingerprint of every single message sent on WhatsApp, which would break end-to-end encryption and fundamentally undermines people’s right to privacy,” a company spokesperson said in a statement to CNN Business. “We have consistently joined civil society and experts around the world in opposing requirements that would violate the privacy of our users. ”

India’s Ministry of Electronics and Information Technology called WhatsApp’s lawsuit an “unfortunate attempt” to prevent the new rules from coming into effect at the last minute.

“The government respects the right of privacy and has no Intention to violate it when WhatsApp is required to disclose the origin of a particular message,” it said in a statement.

The ministry said it would only ask the platform to reveal private data if required for the investigation or prevention of “very serious offenses” related to the sovereignty, security and integrity of India, public order, rape, child sex abuse or sexually explicit material.

WhatsApp counts some 400 million users in India, its biggest market. It deployed end-to-end encryption in 2016 so that calls, messages, photos, videos and voice notes are only shared with the intended recipient and no one else — including WhatsApp. To comply with the traceability demand, WhatsApp would have to keep giant databases of every message, the company said.

A government “that chooses to mandate traceability is effectively mandating a new form of mass surveillance,” WhatsApp has written in a blog post about why it opposes the practice. “Traceability forces private companies to turn over the names of people who shared something even if they did not create it, shared it out of concern, or sent it to check its accuracy.”

WhatsApp began pushing back on India’s demands to trace the source of messages years ago. In 2018, the government told WhatsApp to do more to trace the source of messages, after viral hoaxes on the platform were linked to several lynchings. The company said at the time that doing so would break its end-to-end encryption.

The IT ministry said India was asking for “significantly much less” than other countries have demanded of the tech platform, and was committed to securing the right of privacy for all citizens as well as the means to maintain national security.

“It is WhatsApp’s responsibility to find a technical solution, whether through encryption or otherwise, that both happen,” it added.

The messaging service and other social media firms have lately faced an increasingly difficult environment in India — including the new regulations, which were announced in February just weeks after the government attempted to pressure Twitter to take down accounts it deemed incendiary.

In April, Prime Minister Narendra Modi’s government asked Facebook and Twitter to remove around 100 posts, including some that were critical of Modi’s Covid-19 response.

And earlier this week, Delhi police visited Twitter offices in India to order the social media giant to cooperate with an investigation into a tweet sent by a member of the ruling political party. Twitter had labeled the tweet as “manipulated media.”

Twitter did not respond to a request for comment on the new rules.