Google has lost its case against the FBI's secret warrantless requests for citizen's private and sensitive data, despite its claims — and a prior court decision that has yet to be appealed or go into effect — that the secret "gagging orders" are illegal.

First reported by sister site CNET, a U.S. District Judge in San Francisco has rejected Google's bid to modify or nullify 19 National Security Letters, an unwarranted data gathering request by U.S. federal officials.

It's understood that U.S. District Judge Susan Illston found in favor of the government, after two FBI senior officials — including one assistant director — submitted secret affidavits that ultimately swayed the judge's decision towards the U.S. Justice Dept. and the FBI.

The case was held on May 10 in secret. Because the case was held behind closed doors, much of the hearing remains under lock and key. Google was not even named on the four-page opinion, dated ten days later, by the court's judge.

The FBI has issued more than 300,000 National Security letters since 2000 — with 192,499 letters alone between 2003-2006 — with 97 percent of letters containing a mandatory gagging order.

National Security Letters allow the U.S. Justice Dept. and the FBI to secretly request Web, Internet, and cellular data from companies about a person — and in many cases these companies are legally prevented from disclosing this fact to them. This often prevents the person under suspicion finding out. The FBI argues that this would jeopardize investigations, but it also means that some cannot challenge the order.

In 2008, a Second Circuit ruling found the National Security Letter statute amended by the Patriot Act in 2001 was unconstitutional, and recipients of such letters must be informed so they can challenge them in court. Details such as name, address, and other data is siphoned off by the FBI, so long as it bears relevance to a "national security investigation."

Crucially, there's no judicial oversight. The FBI does not have to go to court to seek such a letter.

In 2008, a Second Circuit ruling found the National Security Letter statute amended by the Patriot Act in 2001 was unconstitutional, and recipients of such letters must be informed so they can challenge them in court. Details such as name, address, and other data is siphoned off by the FBI, so long as it bears relevance to a "national security investigation."

Read this What Google does when a government requests your data In a "frequently asked questions" page, the search giant explains what exactly happens when a government agency or law enforcement requests your personal or private data. Read More

Google first took on the U.S. Justice Dept. earlier in April when it challenged the use of National Security Letters. The search giant wanted Illston to grant a "petition to set aside legal process" in response to a gagging order it had received from the FBI.

Google began disclosing the number of National Security Letters in numerical ranges in March, which Google recognizes people have "voiced concerns about the increase in their use since [the September 11 attacks]."

It came just one week before a U.S. court found that these secret National Security Letters were in breach of the First Amendment, which protects freedom of speech and expression, and were therefore unconstitutional, said Illston, who also presided over the Electronic Frontier Foundation's case earlier this year.

The U.S. government was given a stay on the ruling for an appeal and was told to stop issuing National Security Letters with gag provisions, which expires on June 13.

The Obama administration submitted its appeal on May 6, paving the way for such gagging orders to continue, should the Ninth Circuit agree with the government's case.