The 9th U.S. Circuit Court of Appeals ruled today the federal government can be sued for the National Security Agency's warrantless "dragnet" of Americans' telephone conversations and e-mails.

But in a separate opinion, another three-judge panel of the San Francisco-based court upheld the 2008 law that gave telecommunications companies immunity for aiding the NSA in its hunt for terrorists.

A USA TODAY investigation revealed in May 2006 that the NSA had been secretly collecting call records of tens of millions of Americans, using data provided by AT&T, Verizon and BellSouth. Operating out of a secret room in an AT&T office in San Francisco, the NSA compiled what was described as "the largest database ever assembled in the world."

STORY: NSA has massive database of Americans' phone calls

Q&A: The NSA phone record collection program

Two groups of customers sued the NSA, arguing it violated their privacy by collecting Internet data from AT&T and other big telecoms. The 9th Circuit overturned a lower-court ruling that had dismissed the suits as a "general grievance" from the public, and not an actionable claim, Wired explains.

Courthouse News Service has details on the rulings.