The program's existence had first been disclosed by Edward Snowden, the former NSA contractor whose leaks have detailed the breadth of U.S. electronic surveillance and sparked a debate over how much leeway to give the government in protecting Americans from terrorism.
In a 54-page decision, Pauley said the program "vacuums up information about virtually every telephone call to, from, or within the United States.''
(Read more: NSA may have penetrated Internet cable links)
But the Manhattan federal judge said the program's constitutionality "is ultimately a question of reasonableness,'' and that there was no evidence that the government had used "bulk telephony metadata'' for any reason other than to investigate and disrupt terrorist attacks.
"Technology allowed al Qaeda to operate decentralized and plot international terrorist attacks remotely,'' Pauley wrote. "The bulk telephony metadata collection program represents the government's counter-punch.''