A federal judge on Monday ruled that the National Security Agency's bulk collection of Americans' phone records is likely unconstitutional.

Judge Richard Leon of the U.S. District Court for the District of Columbia found that the program, disclosed by former NSA contractor turned secret-spilling international fugitive Edward Snowden was "almost Orwellian" and appeared to violate the Fourth Amendment's protection against unreasonable search and seizure.

However, he stayed his ruling pending a government appeal.

"I cannot imagine a more 'indiscriminate' and 'arbitrary invasion' than this systematic and high-tech collection and retention of personal data on virtually every single citizen for purposes of querying it and analyzing it without judicial approval," he wrote.

Leon's ruling is a scathing rebuke to the Obama administration, which has continued the controversial phone records collection program begun under the auspices of President George W. Bush. And it's the first major legal blow to a program that proponents have defended by claiming that "every judge" to review it has deemed it constitutional. Until now, that is.

That means the most likely challenge to the program was always going to come from the regular court system.

That's where Leon's ruling comes in. Though he did not definitively call the program unconstitutional, he repeatedly noted that the plaintiffs had a "substantial likelihood" of proving as much, and predicted that future court rulings would bear out his argument.

The oft-cited legal underpinning of the phone records program is a 1979 Supreme Court case, Smith v. Maryland, which held that police could place a "pen register" — a type of phone monitor — on a suspect's phone without first obtaining a warrant. In conjunction, the government has defended the collection of phone records under Section 215 of the Patriot Act. The so-called business records provision permits the collection of "any tangible thing" from a company so long as it's relevant to an "investigation to protect against international terrorism."

In 2006, the NSA, under Bush, convinced the FISA court to issue a secret order agreeing that Section 215 could be used to obtain phone data on virtually anyone. The ruling "essentially gave the NSA authority to place a pen register on everyone's phone," wrote The New Yorker's Ryan Lizza in an exhaustive story on the agency's spying authority, and was thus "a nearly complete victory for the agency."

Addressing the Smith case, Judge Leon swatted down the White House's broad interpretation for three main reasons.

First, he noted that the NSA is collecting information on not one specific person, but on millions of people. Second, the program, rather than taking place during a brief time window, could theoretically go on forever. As a result, Leon wrote that the NSA had essentially roped communications companies into a "joint intelligence-gathering operation with the government," which was much different from police checking a few days' worth of phone records on one suspect.

On a third crucial, if perhaps obvious, front, Leon wrote that the Smith ruling was woefully outdated, rendered obsolete by "technological advances and a cellphone-centric lifestyle heretofore inconceivable."

"When do present-day circumstances — the evolutions in the government's surveillance capabilities, citizens' phone habits, and the relationship between the NSA and telecom companies — become so thoroughly unlike those considered by the Supreme Court 34 years ago that a precedent like Smith simply does not apply?" he wrote. "The answer unfortunately for the government, is now."

Though the ruling did not have an immediate, tangible impact on government surveillance, it could have a ripple effect on future rulings that ultimately weakens the program. Past challenges to the NSA's actions have been dismissed for lack of standing: Plaintiffs have been unable to prove they were impacted by secret programs, and thus prevented from mounting challenges in the first place. Leon argued that they no longer should be.

In February, the Supreme Court threw out a legal challenge from the ACLU and others to the NSA's warrantless wiretapping for that very reason. But that was before the Snowden leaks revealed the NSA was collecting information on pretty much everyone. Leon wrote that Snowden's disclosures about the full extent of the NSA's snooping resolved that question of standing, clearing the way for future litigation to advance past that old stumbling block.

The White House, for its part, has maintained the program is completely legal.

"We've seen the opinion and are studying it," the Justice Department said in a terse statement. "We believe the program is constitutional as previous judges have found."

But now, for the first time, one has not. It may be only a matter of time before a court definitively strikes down the program, as it is currently constructed.