A federal surveillance court on Tuesday released a declassified opinion upholding the constitutionality of the National Security Agency’s sweeping collection of billions of Americans’ phone records for counterterrorism purposes.

The gathering of “all call detail records” from phone companies is justified as long as the government can show that it is relevant to an authorized investigation into known — and, significantly — unknown terrorists who may be in the United States, the Aug. 29 opinion states.

Moreover, the government need only show that there are “reasonable grounds to believe” the records will be relevant to the investigation, a lower burden than required in ordinary criminal investigations. That is justified because the goal is to prevent a terrorist attack, not solve a crime that has already taken place, the court said, affirming the government’s position.

Taken together, the argument is a bold assertion of authority that critics say is not justified by the Foreign Intelligence Surveillance Act (FISA) or the Constitution. Some elements of the court’s reasoning had been discussed in an earlier Justice Department white paper released by the government, but the concept of the “unknown” terrorist and the argument for the lower burden had not been explicitly linked to the program.

The 29-page opinion signed by Claire V. Eagan, a judge on the secretive Foreign Intelligence Surveillance Court (FISC), is the first to be released that addresses the constitutionality of the NSA’s “bulk records” collection of phone data. It is an attempt to address growing criticism about the broad surveillance since its existence was disclosed in June in a document leaked to the Guardian, a British newspaper, by former NSA contractor Edward Snowden. The program was authorized by the court in 2006 under Section 215 of the Patriot Act, which amended FISA, but that was not known until June. In the program, the NSA gathers records of phone calls, their time and duration, but not subscriber names or call content.

The opinion was released at Eagan’s will, Justice Department officials said, not at the request of the government or in response to lawsuits from civil liberties groups. Eagan, appointed to the federal bench in Oklahoma by President George W. Bush, is a fairly new member of the FISC.

A senior Justice Department official said that it is not a substitute for the release of other lengthier, significant opinions relating to the surveillance program.

Privacy advocates reacted with dismay upon reading the ruling.

“This isn’t a judicial opinion in the conventional sense,” said Jameel Jaffer, American Civil Liberties Union deputy legal director. “It’s a document that appears to have been cobbled together over the last few weeks in an effort to justify a decision that was made seven years ago. I don’t know of any precedent for that, and it raises a lot of questions.”

Jaffer added that the opinion was “completely unpersuasive” as a defense of the call-records program. The constitutional analysis fails to mention the landmark United States v. Jones privacy case decided by the Supreme Court last year, which suggested a warrant was necessary for long-term tracking of GPS data, he said. And Eagan’s analysis of the statute overemphasizes some terms while ignoring others, he said.

“On the whole, the opinion only confirms the folly of entrusting privacy rights to a court that hears argument only from the government,” said Jaffer, referring to the fact that there is no adversary in the classified proceedings.

Eagan’s ruling endorsed the government's argument that the broad collection was necessary to find unknown terrorist operatives who may be in the United States “because it is impossible to know where in the data the connections to international terrorist organizations will be found.”

The senior Justice Department official said the “unknown” language was important. “If you know who all the people were, you would just ask [the phone companies] for those numbers,” he said. “So that’s why you need all those numbers. . . . The bottom line is this: You have to have this larger body of data to find the needles in the haystack.”

The ruling also reaffirmed the government’s contention, upheld by the Supreme Court in 1979, that Americans have no reasonable expectation of privacy in records of their calls held by phone companies, and a warrant to collect them is not required. A warrant would be required to wiretap the calls.

Eagan asserted that to date, no company has challenged the legality of an order. She also stated that Congress ratified the program when it reauthorized the statute without change in 2010 and 2011, because it had access to information on the statute’s application to the phone program.

Kurt Opsahl, senior staff attorney at Electronic Frontier Foundation, disagreed. “The outrage of many Congress members” upon hearing about the program’s scope “shows this is not true. We should not have the legal basis of the surveillance state resting on a judicially created legal fiction.”