In the ruling, Judge William H. Pauley III, of the United States District Court for the Southern District of New York, granted a motion filed by the federal government to dismiss a challenge to the program brought by the American Civil Liberties Union, which had tried to halt the program.
Judge Pauley said that protections under the Fourth Amendment do not apply to records held by third parties, like phone companies.
“This blunt tool only works because it collects everything,” Judge Pauley said in the ruling.
“While robust discussions are underway across the nation, in Congress and at the White House, the question for this court is whether the government’s bulk telephony metadata program is lawful. This court finds it is,” he added.
A spokesman for the Justice Department said, “We are pleased the court found the N.S.A.'s bulk telephony metadata collection program to be lawful.” He declined to comment further.
Jameel Jaffer, the A.C.L.U. deputy legal director, said the group intended to appeal. “We are extremely disappointed with this decision, which misinterprets the relevant statutes, understates the privacy implications of the government’s surveillance and misapplies a narrow and outdated precedent to read away core constitutional protections,” he said.
The ruling comes nearly two weeks after Judge Richard J. Leon of Federal District Court for the District of Columbia said the program most likely violated the Fourth Amendment. As part of that ruling, Judge Leon ordered the government to stop collecting data on two plaintiffs who brought the case against the government.
In his ruling, Judge Leon said that the program “infringes on ‘that degree of privacy’ that the founders enshrined in the Fourth Amendment,” which prohibits unreasonable searches and seizures.
While Judge Leon ordered the government to stop collecting data on the two plaintiffs, he stayed the ruling, giving the government time to appeal the decision.
Judge Pauley, whose courtroom is just blocks from where the World Trade Center towers stood, endorsed arguments made in recent months by senior government officials — including the former F.B.I. director Robert S. Mueller III — that the program may have caught the Sept. 11, 2001, hijackers had it been in place before the attacks.
In the months before Sept. 11, the N.S.A. had intercepted several calls made to an Al Qaeda safe house in Yemen. But because the N.S.A. was not tracking all phone calls made from the United States, it did not detect that the calls were coming from one of the hijackers who was living in San Diego.
“Telephony metadata would have furnished the missing information and might have permitted the N.S.A. to notify the Federal Bureau of Investigation of the fact that al-Mihdhar was calling the Yemeni safe house from inside the United States,” Judge Pauley said, referring to the hijacker, Khalid al-Mihdhar.
Judge Pauley said that the “government learned from its mistake and adapted to confront a new enemy: a terror network capable of orchestrating attacks across the world.”
The government, he added, “launched a number of countermeasures, including a bulk telephony metadata collection program — a wide net that could find and isolate gossamer contacts among suspected terrorists in an ocean of seemingly disconnected data.”
The main dispute between Judge Pauley and Judge Leon was over how to interpret a 1979 Supreme Court decision, Smith v. Maryland, in which the court said a robbery suspect had no reasonable expectation that his right to privacy extended to the numbers dialed from his phone.
“Smith’s bedrock holding is that an individual has no legitimate expectation of privacy in information provided to third parties,” Judge Pauley wrote.
But Judge Leon said in his ruling that advances in technology and suggestions in concurring opinions in later Supreme Court decisions had undermined Smith. The government’s ability to construct a mosaic of information from countless records, he said, called for a new analysis of how to apply the Fourth Amendment’s prohibition of unreasonable government searches.
Judge Pauley disagreed. “The collection of breathtaking amounts of information unprotected by the Fourth Amendment does not transform that sweep into a Fourth Amendment search,” he wrote.
He acknowledged that “five justices appeared to be grappling with how the Fourth Amendment applies to technological advances” in a pair of 2012 concurrences in United States v. Jones. In that decision, the court unanimously rejected the use of a GPS device to track the movements of a drug suspect over a month. The majority in the 2012 case said that attaching the device violated the defendant’s property rights.
In one of the concurrences, Justice Sonia Sotomayor wrote that “it may be necessary to reconsider the premise that an individual has no reasonable expectation of privacy in information voluntarily disclosed to third parties.”
But Judge Pauley wrote that the 2012 decision did not overrule the one from 1979. “The Supreme Court,” he said, “has instructed lower courts not to predict whether it would overrule a precedent even if its reasoning has been supplanted by later cases.”
As for changes in technology, he wrote, customers’ “relationship with their telecommunications providers has not changed and is just as frustrating.”