Section 215 of the Patriot Act allows the government to collect business records if there is reason to believe the records are "relevant" to a terrorism investigation.
In the opinion, Judge Claire Eagan wrote that the concept of relevance is "in fact broad and amounts to a relatively low standard."
She concluded that the NSA needs to collect the phone data in bulk to keep track of potential plots, including those by unknown terrorists.
"Because it is necessary to obtain the bulk collection of a telephone company's metadata to determine those connections between known and unknown international terrorist operatives as part of authorized investigations, the production of the information sought meets the standard for relevance under Section 215," she wrote.
She noted the court imposes limitations on the ability of NSA analysts to access and sift through the vast database of phone calls.
The telecommunications companies never challenged the court orders, Eagan wrote.
Eagan also argued that Congress ratified the court's interpretation of the Patriot Act by re-authorizing the law in 2011. She explained that the executive branch invited all members of Congress to view intelligence documents describing the program in a classified room.
Many members of Congress, including Rep. Jim Sensenbrenner (R-Wis.), the author of the Patriot Act, have said they were shocked to learn how the NSA and the court have been interpreting Section 215. But Eagan wrote in a footnote that it is unnecessary to inquire how many of the 535 members of Congress actually took advantage of the opportunity to view the documents.
Eagan also concluded that the program does not violate the Fourth Amendment's ban on unreasonable searches and seizures. Pointing to the 1979 Supreme Court decision Smith v. Maryland, she argued that people do not have an expectation of privacy for the metadata they share with their phone company.
But she acknowledged the public outcry that the leaks about the program have prompted.
"In the wake of these disclosures, whether and to what extent the government seeks to continue the program discussed in this memorandum opinion is a matter for the political branches to decide," she wrote.
Jameel Jaffer, the deputy legal director for the American Civil Liberties Union, said the court's opinion is "completely unpersuasive."
"On the whole, the opinion only confirms the folly of entrusting Americans’ privacy rights to a court that meets in secret and hears argument only from the government," he said in a statement. “This isn’t a judicial opinion in the conventional sense, it’s a document that was cobbled together over the last few weeks to justify a secret decision that was made seven years ago."