WASHINGTON

- In a ruling with potentially far-reaching consequences, a federal judge declared yesterday that the National Security Agency's bulk collection of millions of Americans' telephone records likely violates the U.S. Constitution's ban on unreasonable search. The ruling, filled with blistering criticism of the Obama administration's arguments, is the first of its kind on the controversial program.

Even if the NSA's "metadata" collection of records should pass constitutional muster, the judge said, there is little evidence that it has ever prevented a terrorist attack. The collection program was disclosed by former NSA systems analyst Edward Snowden, provoking a heated national and international debate.

U.S. District Judge Richard Leon granted a preliminary injunction against the collecting of the phone records of two men who had challenged the program and said any such records for the men should be destroyed. But he put enforcement of that decision on hold pending a near-certain government appeal, which may end up at the Supreme Court.

The injunction applies only to the two individual plaintiffs, but the ruling is likely to open the door to much broader challenges to the records collection and storage.

The plaintiffs are Larry Klayman, a conservative lawyer, and Charles Strange, the father of a cryptologist technician who was killed in Afghanistan when his helicopter was shot down in 2011. The son worked for the NSA and support personnel for Navy SEAL Team VI.

Leon, an appointee of President George W. Bush, ruled that the two men "have a substantial likelihood of showing" that their privacy interests outweigh the government's interest in collecting the data "and therefore the NSA's bulk collection program is indeed an unreasonable search under the Constitution's Fourth Amendment."

"I have little doubt that the author of our Constitution, James Madison, who cautioned us to beware 'the abridgment of freedom of the people by gradual and silent encroachments by those in power,' would be aghast," he declared.

The government has argued that under a 1979 Supreme Court ruling, Smith v. Maryland, no one has an expectation of privacy in the telephone data that phone companies keep as business records. In that ruling, the high court rejected the claim that police need a warrant to obtain such records.