(07-20) 11:20 PDT SAN FRANCISCO -- A phone company is testing the limits of government secrecy and information-gathering in a federal court in San Francisco by challenging the FBI's demand for a customer's records.

The FBI issues tens of thousands of secretive national security letters every year, requiring telecommunications companies, banks and others to turn over records of patrons that the government considers to be relevant to a national security investigation.

Unlike search warrants or subpoenas that government agencies typically use to obtain documents, the FBI issues the letters on its own without advance approval from a judge or a grand jury. They are accompanied by gag orders forbidding the recipients to publicly identify themselves, their customers or the type of information that is being sought.

Gag order

In a lawsuit pending in federal court in San Francisco, the phone company - whose name is blacked out by the gag order - says the demand for customer information violates freedom of association and the right to speak anonymously. The gag order, the phone company asserts, is an unconstitutional restraint on speech.

National security letters "invade First Amendment territory because they compel production of records relating to communications," the company's lawyers said in a filing to U.S. District Judge Susan Illston, who heard arguments last fall but has not yet ruled.

Justice Department lawyers said the letters are justified by "the government's compelling interest in law enforcement." The bureau is demanding only billing records and "does not seek the content of any conversation," they said.

Unnamed customer

The letter was issued last year sometime before May 2, the date the company went to court. The FBI wants the name, address and length of service on all accounts held by the publicly unnamed customer.

This is only the second legal challenge to a national security letter since their use was greatly expanded by the USA Patriot Act in 2001, said Matt Zimmerman of the Electronic Frontier Foundation, a lawyer for the phone company. The first challenge, in New York, was dropped when the FBI withdrew the letter, he said.

In a typical case, he said Thursday, "the FBI got a phone number and doesn't know who it belongs to. We don't know why they think the phone number is important. They want to know who called that number, who called from that number. They're trying to make connections."

Seldom challenged

The bureau's interest may well be justified, Zimmerman said, but "the courts play absolutely no role in the process to ensure that the FBI doesn't overreach." Because recipients of the letters have no way of knowing whether they were properly issued, he said, they are virtually never challenged.

In 2007, the Justice Department's inspector general reported that as many as 3,000 national security letters issued between 2003 and 2005 violated the law or some government policy. The causes included inadequate training and supervision, the report said.

The FBI has made significant progress in addressing those problems, Justice Department lawyers said in a filing in the San Francisco case - an assertion that the phone company's attorneys called an "empty assurance ... not supported by any evidence."