Microsoft is suing the US Department of Justice to try to prevent the government from forcing tech companies to turn over data without their customers' knowledge.
The software giant filed the case in federal court on Thursday with an aim to strike down a key legal mechanism used by the government, a tool that can force companies to turn over data but gags them from informing their customers.
These gag orders -- typically used in national security investigations -- prevent tip-offs, which may result in leaks or destruction of data.
But that's becoming an increasingly bigger problem for tech companies, like Microsoft, which over the past 18 months has been forced to maintain secrecy in 2,576 cases.
In more than two-thirds of those cases, the company has been gagged permanently.
Microsoft chief counsel Brad Smith said in a blog post on Thursday that it was "not a decision we made lightly" to take on the government, but Microsoft did so because the company believes "that critical principles and important practical consequences are at stake."
"We believe that with rare exceptions consumers and businesses have a right to know when the government accesses their emails or records," said Smith. "Yet it's becoming routine for the US government to issue orders that require email providers to keep these types of legal demands secret."
Smith argued that the gag orders are unconstitutional and in breach of the First Amendment, which "guarantees our right to talk to customers about how government action is affecting their data."
It's not the first time that the gag order provision has been called unconstitutional.
A California judge in 2013 said that imposing gag orders on companies was in breach of free speech and expression. It followed a 2008 ruling by the US Appeals Court for the Second Circuit, which first put provisions on the use of gag orders.
The use of so-called national security letters has risen since they were introduced by the Patriot Act in 2001.
National security letters don't require a court order and can be issued by the FBI. Last year, it was revealed that the government can compel companies to turn over complete web browsing histories, the IP addresses of everyone a person has corresponded with, online purchase information, and also cell-site location information, and more.
But the company was successful in having one national security letter withdrawn.
Twitter is also fighting the government for permission to disclose the exact number of national security letters it receives. Currently, companies are only allowed to report in bands of 1,000.
A Microsoft spokesperson did not have any additional comment beyond the blog post.
You can read the full lawsuit below.