The Electronic Frontier Foundation filed the action on behalf of a variety of groups including the First Unitarian Church of Los Angeles, the gun rights group Calguns Foundation, Greenpeace and Human Rights Watch.

The suit filed in California federal court alleges that the mass collection of phone records under the so-called PRISM program violates Americans' constitutional rights.

"Our case seeks to apply the right of association in the digital age," said EFF attorney Cindy Cohn.

Cohn said the suit, based on a longstanding Supreme Court ruling, contends the government's collection of "metadata" or information on calls placed, without the content of the conversation, allows the government to monitor who is associating with various groups.

"People who hold controversial views -- whether it's about gun ownership policies, drug legalization, or immigration -- often must express views as a group in order to act and advocate effectively," said Cohn.

"But fear of individual exposure when participating in political debates over high-stakes issues can dissuade people from taking part. That's why the Supreme Court ruled in 1958 that membership lists of groups have strong First Amendment protection."

Sherwin Siy of the digital advocacy group Public Knowledge, which joined the lawsuit, said the programs "don't just invade privacy; they also harm people's First Amendment right of association."

"When the government collects information about who calls whom, when, and how often, they get a vivid picture of a person's contacts and associations. In the past, authorities have tried to compile lists of association members to discourage people from joining certain groups," Siy said.

Others joining the suit include the California Association of Federal Firearms Licensees, Competitive Enterprise Institute, Council on American Islamic Relations, National Organization for the Reform of Marijuana Laws, People for the American Way and Students for a Sensible Drug Policy.

The case is the latest in a wave of legal action since revelations in the media about the PRISM program, believed to collect vast amounts of phone and Internet data as part of efforts to protect national security.

In a separate case Monday, the secret US court overseeing national security investigations opened the door to declassifying documents related to the government's data collection program in a case involving Internet giant Yahoo!

The Foreign Intelligence Surveillance Court said the government should review which documents should be declassified and inform the court of its decision by July 29.

The case dates back at least to 2008, when the court issued an order reportedly requiring Yahoo! to allow the government to obtain access to customer data. The Justice Department took "no position" on the request, according to the court document.

Judge Reggie Walton said the Justice Department should address the matter with "priority."

Yahoo! asked the court on June 14 to release documents about the program, shortly after revelations of the vast data collection program.

Other Internet companies including Google and Microsoft have also sought declassification of documents.

The companies have stated they release information only in response to specific court orders, and claim that reports about providing easy access to US authorities are exaggerated.

Yahoo! welcomed the judge's order.

"We're very pleased with the decision by the Foreign Intelligence Surveillance Court (FISC) ordering the government to conduct a declassification review of the Court's Memorandum of Opinion of April 25, 2008, as well as the legal briefs submitted," a Yahoo! statement said.

"Once those documents are made public, we believe they will contribute constructively to the ongoing public discussion around online privacy."

Apple, Facebook, Microsoft and other top Internet and technology companies have come under heightened scrutiny since word leaked of the vast, covert Internet surveillance program US authorities insist targets only foreign terror suspects and has helped thwart attacks.