A US District Court judge in San Francisco has dismissed a lawsuit brought against the US government by individuals who say their rights were infringed by the National Security Agency's warrantless wiretapping program.

The Electronic Frontier Foundation, a privacy watchdog that participated in the lawsuit, described the judge's ruling as declaring "that mass surveillance of Americans is immune from judicial review."

Nine plaintiffs -- five customers of telecom companies from California and four others from Brooklyn -- had sued the NSA arguing that their rights had been infringed by the wiretapping program, which potentially could have spied on anyone in the United States.

"This ruling robs innocent telecom customers of their privacy rights without due process of law," EFF legal director Cindy Cohn said in a statement. "Setting limits on executive power is one of the most important elements of America's system of government, and judicial oversight is a critical part of that."

But the judge's decision did not directly address the issue of limiting executive power. In his ruling (PDF), District Chief Judge Vaughn Walker argued that the plaintiffs could not prove that they were personally harmed by NSA wiretapping.

"The harm alleged is a generalized grievance shared in equally substantial measure by all or a large class of citizens," Judge Walker wrote.

The judge cited a number of legal precedents, in which courts declared that if harm is done to the public in general, the remedy should be political, not judicial.

"The alarming upshot of the court's decision is that so long as the government spies on all Americans, the courts have no power to review or halt such mass surveillance even when it is flatly illegal and unconstitutional," said EFF lawyer Kevin Bankston.

In defending against the suit, the US government argued it had a right to keep the warrantless wiretapping program secret because releasing the details could compromise national security, and because of the doctrine of sovereign immunity.

But Judge Walker did not address the government's claim that it was immune from the lawsuit. The judge wrote that because he dismissed the case on the grounds that the plaintiffs didn't have legal standing, he did not have to rule on the government's argument.

Judge Walker is also currently presiding over the Proposition 8 gay-marriage trial in San Francisco.

Writing at FireDogLake, blogger Marcy Wheeler said the issue of government privilege would likely be resolved in two other court cases. One involves the al-Haramain Islamic Foundation, a group listed by the UN as a sponsor of terrorism. The foundation has sued the US government over the wiretapping of three of its members.

The other case involves Jeppesen, a subsidiary of Boeing that has been implicated in the CIA's "extraordinary rendition" practice, which saw terrorist suspects flown to countries where they could be tortured with legal immunity. Last year, a federal appeals court rejected the government's claim of "state secrets privilege" in that case, and ordered the case to go forward.