The US government's collection of massive amounts of data about telephone calls is likely unlawful, a judge there has ruled.
US District Judge Richard Leon stayed his own ruling pending an expected appeal by the government.
However, in a significant challenge to US spying authority, he wrote that the programme likely violated Americans' right to be free of unreasonable searches.
The programme, which was revealed in June following leaks by former contractor Edward Snowden, involves the National Security Agency's collection of phone call data, such as numbers dialled and duration of call.
"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," Judge Leon wrote, citing earlier court precedent.
The US Justice Department was reviewing the ruling, a spokesman said.
The Guardian newspaper in Britain had reported in June that a US surveillance court had secretly approved the collection of millions of raw daily phone records, such as the length of calls and the numbers that are dialled.
The data collected does not include actual conversations, US officials said.
Civil liberties advocates have called the database an intrusion on privacy and they sued to end it, while the government has said the ability to search data going back seven years is crucial to fighting militant groups such as al-Qaeda.
Judge Leon expressed scepticism of the programme's value, writing that the government could not cite a single instance in which the bulk data actually stopped an imminent attack.
White House dismisses Snowden amnesty deal
Separately, White House spokesman Jay Carney dismissed the suggestion that the US could grant amnesty to Mr Snowden if he were to turn over the documents in his possession.
"Our position has not changed on that matter at all," Mr Carney told reporters at a briefing in response to a question.
"Mr Snowden has been accused of leaking classified information and he faces felony charges here in the United States. He should be returned to the United States as soon as possible, where he will be accorded full due process in our system."
Mr Snowden has been granted temporary asylum by Russia.
Rick Ledgett, who is supervising the NSA task force doing a damage assessment of the Snowden leaks, said on the CBS programme "60 Minutes" that it was "worth having a conversation about" granting Mr Snowden asylum if he were to turn over the information he had taken.
"My personal view is, yes, it's worth having a conversation about," Mr Ledgett said.
"I would need assurances that the remainder of the data could be secured and my bar for those assurances would be very high."