A federal judge on Friday found that the National Security Agency's bulk collection of millions of Americans' telephone records is legal and a valuable part of the nation's arsenal to counter the threat of terrorism.

The decision counters another Federal Judge’s ruling just weeks ago that said the “almost Orwellian” program was likely unconstitutional. The disparate outcomes at the Federal level mean that the final word on the NSA’s programs may have to come from the Supreme Court.

U.S. District Judge William Pauley said in a written opinion on Friday that the program "represents the government's counter-punch" to eliminate Al-Qaeda's wide-ranging network by connecting fragmented and fleeting communications.

In the ruling, the judge noted the Sept. 11 attacks and said the phone data-collection system could have helped investigators connect the dots before the attacks occurred.

"The government learned from its mistake and adapted to confront a new enemy: a terror network capable of orchestrating attacks across the world. It launched a number of counter-measures, 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," he said.

That language is notable, said New York University law professor Barry Friedman, because it suggests Pauley buys into the idea that attacks have been prevented by the analysis of metadata. The NSA hasn’t acknowledged a specific instance where its program has helped stop an attack.