A U.S. judge ruled that a National Security Agency program that collects records of millions of Americans' phone calls is not illegal, referring to the act as a "counter-punch" to terrorism that does not violate Americans' privacy rights, Reuters reported.

The decision, made Friday by U.S. District Judge William Pauley in Manhattan diverged from a ruling by another judge earlier this month that questioned the program's "constitutionality, raising the prospect that the Supreme Court will need to resolve the issue," Reuters reported.

American Civil Liberties Union lawsuit contending that the NSA collection of "bulk telephony metadata" violated the bar against warrantless searches under the Fourth Amendment of the U.S. Constitution was dismissed by Pauley.

In his 54-page decision, the judge often referred to the September 11, 2001 attacks, in which nearly 3,000 people died, saying programs such as NSA's could prevent another event like this from happening.

"This blunt tool only works because it collects everything," Pauley wrote, according to Reuters. "Technology allowed al Qaeda to operate decentralized and plot international terrorist attacks remotely. The bulk telephony metadata collection program represents the government's counter-punch."

The program's existence was first disclosed by former NSA contractor Edward Snowden, who is now in Russia under temporary asylum. His leaks have sparked a debate over how much leeway to give the government in protecting Americans from terrorism.

Pauley's decision comes just 11 days after U.S. District Judge Richard Leon in Washington, D.C. said the "almost Orwellian" NSA program amounted to an "indiscriminate and arbitrary invasion" that was likely unconstitutional, Reuters reported.

Leon also asked the U.S. government to stop collecting call data on the two plaintiffs in that case, "but suspended that portion of his decision so the government could appeal."

In their case, the ACLU argued that the NSA program was an unwarranted "dramatic expansion" of the government's investigative powers over U.S. citizens' day-to-day lives.

Deputy Legal Director of ACLU Jameel Jaffer told Reuters on Friday that the group was disappointed with Pauley's rule. He said the decision does away with "core constitutional protections."

The organization will appeal to the 2nd U.S. Circuit Court of Appeals in New York, Reuters reported.