U.S. District Court Judge Richard Leon's ruling in a case challenging the National Security Agency's bulk collection of phone records sets up what's likely to be a contentious legal battle to impose limits on government surveillance in the U.S.

Leon, a judge for the U.S. District Court for the District of Columbia, on Monday held that the NSA's warrantless collection of phone records on millions of Americans might be unconstitutional.

In a bluntly worded 68-page decision, Leon ruled that the plaintiffs in the case had a strong legal basis for challenging the constitutionality of the government's data collection efforts. Based on information presented to the court, the plaintiffs had demonstrated "a substantial likelihood of success on the merits of their Fourth Amendment claim," Leon noted.

The ruling is the first one to directly address the legality of the NSA's phone records collection since Edward Snowden first began leaking details of its activities to the media in June.

Lawmakers who back the NSA program and those who want to end it are already squaring off over what it means.

Sen. Patrick Leahy (D-VT), who has joined other lawmakers to sponsor a bill to end the NSA program, applauded the ruling. "Americans deserve an open and transparent debate about the constitutionality, efficacy, and appropriateness of the government's dragnet collection programs," he said in a statement Monday.

But Sen. Dianne Feinstein (D-Calif.), chairman of the Senate Intelligence Committee, has sponsored a bill that seeks to codify many of the NSA activities into law. She expressed reservations over Leon's opinion, and noted that it ran counter to the opinions of 15 separate federal judges who authorized the program while acting as judges for the Foreign Intelligence Surveillance Court (FISC).

FISC was set up to oversee the program.

Leon's opinion also differs from a ruling by a federal judge in California last month in a case involving four people charged with providing material support to Somali terrorists. In that case, Judge Jeffrey Miller of the Southern District of California held that the information collected under the calls records program by the NSA and provided to the FBI could be used as evidence against them.

"Clearly, we have competing decisions from those of at least three different courts (the FISA Court, the D.C. District Court and the Southern District of California)," Feinstein said in a statement. "Only the Supreme Court can resolve the question on the constitutionality of the NSA's program."

Rights advocacy groups were quick to hail the Monday decision as a significant victory for those seeking limits on the surveillance activities carried out by the government under the aegis of counter-terrorism.

"A federal court has now concluded that the program does, in fact, violate the Fourth Amendment," said Marc Rotenberg, executive director of the Electronic Privacy Information Center. "While we anticipate that the government will appeal the decision, this could be the beginning of the end for the NSA's sweeping and controversial domestic data collection practices."

Leon's often-scathing language in describing the NSA's Bulk Telephony Metadata Program was seen as particularly encouraging by many opposed to the surveillance practices.

In a blog post, the Electronic Frontier Foundation (EFF) highlighted several examples of Leon's unequivocal criticism of the NSA program. The advocacy group expressed particular satisfaction over Leon's decision to address a crucial 1979 Supreme Court ruling (Smith v. Maryland) that has often been cited by the government as a legal basis for the call records collection. In that ruling, the Supreme Court held that phone subscribers should have no legitimate expectation of privacy over metadata records acquired by the government directly from service providers.

In his opinion, Leon held that technological advances since that 1979 ruling made the issues in the current case a "far cry" from those considered 34 years ago.

"We are very happy the court could understand and appreciate that technology has evolved to such a degree, that Smith v. Maryland doesn't control," said Hanni Fakhoury, a staff attorney with EFF. "That understanding of Smith goes beyond just the NSA context, and implicates other forms of electronic surveillance, such as collection of cell site records and Internet metadata."

Copyright 2018 IDG Communications. ABN 14 001 592 650. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of IDG Communications is prohibited.