An avalanche of legal challenges to the National Security Agency threaten to upend one of the most delicate balances the surveillance agency labors to strike: its critical relationship with telecommunications and internet companies.

An unlikely coalition of advocacy groups are taking the NSA to court, claiming the bulk surveillance it conducts on Americans phone records and their online habits is unconstitutional. One of them is aiming beyond the NSA itself, and at the companies the NSA partners with for much of that data.

The NSA's relationship with those companies is critical, since much of the telecommunications infrastructure of the United States is owned and operated by private firms. While the lawsuits face significant obstacles, they stand a chance of splitting the financial and legal interests of the telecoms firms and and Internet Service Providers from those of the NSA – something that could restrict the surveillance efforts more than any legislation Congress is likely to pass.

"Without the companies' participation," said former NSA codebreaker William Binney, "it would reduce the collection capability of the NSA significantly."

The lawsuits, which take several different paths to blocking the bulk surveillance, are proliferating quickly.

One filed on Tuesday in a California federal court united a coalition of 19 gun owners, human-rights groups, Muslim organizations, environmentalists and marijuana legalization advocates seeking a "preliminary and permanent injunction" against NSA surveillance. Their claims about the surveillance violating their speech and privacy rights echoed another suit filed last month in a New York federal court by the ACLU challenging the programs' constitutionality.

Similarly, a suit first filed in California five years ago was resurrected last week after a judge ruled that revelations about bulk surveillance published by the Guardian and the Washington Post and confirmed by the government prevent the Justice Department from quashing the suit as a state secret. The Electronic Privacy Information Center petitioned the supreme court last week to "vacate an unlawful order" by the secretive Fisa court for mass phone records from Americans.

Those cases still face the considerable challenges of fighting and defeating what are sure to be vigorous Justice Department challenges to their viability. Thus far, the courts have most often ruled for the government in NSA surveillance suits. Unlike in the past, however, the NSA documents published by the Guardian and the Post revealed for the first time that telecoms and Internet Service Providers were directly providing NSA with bulk customer information, allowing those customers – including the ACLU, a Verizon customer – standing to sue.

But even if all those cases fail, there's another legal avenue to contest the surveillance, albeit a difficult one: lawsuits against the companies themselves.

That's what the conservative group Judicial Watch is attempting. The organization filed a class-action suit last month against the internet companies named as participating in the NSA's Prism program, including Microsoft, AOL, Facebook, Google and Apple. Cases like that have long frightened the NSA.

The NSA and its allies in Congress have gone to great lengths to legally shield the private-sector telephone and internet companies it works with. A 2008 law that broadened the scope of the Foreign Intelligence Surveillance Act, known as the Fisa Amendments Act, retroactively immunized any participating telecom firm from legal liability. According to an internal NSA history of the program, several firms specifically requested NSA compel them to comply through Fisa court orders, fearing an eventual court case.

Underscoring how delicately the NSA treats the sanctity of its private-sector partners, the NSA would only refer to them even in a classified internal document as "Company A" and similar pseudonyms.

That sensitivity exists because the telecommunications firms largely own and operate the infrastructure used to make phone calls, send emails and conduct web searches, unlike in authoritarian countries like China, North Korea and the former East Germany. Without the companies' participation, the NSA could still perform so-called "upstream" collection, such as accessing data as it transmits, for instance, across fiberoptic cables before the companies process them. "But they can't get a complete copy of everything without going to the companies," Binney said.

Lawsuits against the companies place tensions, both legal and financial, on their partnership with NSA. Even the threat of spending money in court to quash customer lawsuits carries the potential for the companies to reassess the scope of their longstanding relationships with the surveillance agency.

The lawsuits are a more direct challenge to the NSA than the convoluted and uncertain legislative or political processes. While several senators and members of Congress are talking about revising the Patriot Act to restrict bulk telephone records collection, support in Congress for the NSA runs deep, and it is difficult to forecast what reforms, if any, might pass. Similarly, the secret Fisa Court bristles at accusations that it's a rubber stamp, but it approves almost all surveillance requests.

That leaves citizens upset with the surveillance to pursue their rights as customers of the companies participating with the NSA.

"If you want to raise costs to the companies participating with NSA, you raise the time and effort they spend defending themselves from allegations that their participation in NSA surveillance programs is unlawful," said Amie Stepanovich, a lawyer with the Electronic Privacy Information Center. "But the downfall of suing the companies are the companies' inevitable filings that they were just complying with the law."

Yet the obstacles to suing the companies are significant. The 2008 law explicitly says: "No cause of action shall lie in any court against any electronic communication service provider for providing any information, facilities, or assistance."

Alex Abdo, a lawyer with the ACLU working on the civil liberties group's challenge to the NSA, said the immunization provisions are not necessarily insurmountable for suing the companies.

"You could still sue Verizon and ask them to stop, even if you're not asking for damages," Abdo said. "I don't think the immunity provision applies to that."

Even as the scope of the companies' liability is set to be litigated, some of the NSA's partners are attempting to limit their customers' discontent. On Tuesday, Microsoft publicly asked Attorney General Eric Holder to lift the veil of secrecy over its cooperation with NSA so it can "publish the volume of national security requests we have received." That followed a Monday ruling by the Fisa court for the Justice Department to release information showing Yahoo at times resisted cooperation even when compelled by the court.