Media playback is unsupported on your device Media caption Carney: Snowden "should be returned to the United States as soon as possible"

A US judge has ruled the National Security Agency's mass collection of telephone data may be unconstitutional.

Federal District Judge Richard Leon said the electronic spy agency's practice was an "arbitrary invasion".

The agency's collection of "metadata", including telephone numbers and times and dates of calls, was exposed by ex-NSA contractor Edward Snowden.

The White House dismissed a suggestion Mr Snowden could receive amnesty if he stopped leaking documents.

On Monday in a Washington DC federal court, Judge Leon called the NSA's surveillance programme "indiscriminate" and an "almost Orwellian technology that enables the government to store and analyze the phone metadata of every telephone user in the United States".

'Irreparable harm'

The ruling came in a lawsuit brought by conservative activist Larry Klayman, a user of a Verizon mobile telephone who challenged the NSA's collection of metadata on his behalf and that of a client.

Media playback is unsupported on your device Media caption An ex-NSA official tells the BBC the government will have a difficult time challenging the ruling

On Tuesday morning, US President Barack Obama met chief executives from the nation's top technology companies - including Google and Apple.

He was expected to discuss the NSA's surveillance programmes as well as government information technology reforms; the legal ruling may also come up.

The NSA had ordered Verizon - one of the largest phone companies in the US - to disclose to it metadata, including telephone numbers, calling card numbers and the serial numbers of phones, of millions of calls it processes in which at least one party is in the US.

Judge Leon ruled the plaintiffs had demonstrated "a substantial likelihood of success on the merits of their Fourth Amendment claim and that they will suffer irreparable harm absent… relief", referring to the clause in the US constitution that bars unreasonable search and seizure by the government.

He issued a preliminary injunction against the NSA surveillance programme but suspended the order to allow for an appeal by the justice department, thus enabling the programme to continue for now.

Mr Klayman told the BBC the ruling "could have immediate impact.

"If the NSA continues to do this, they're now on notice that it's illegal, and we will seek to have them held in criminal contempt of court."

Through Glenn Greenwald, a journalist with whom he has close ties, Mr Snowden issued a statement hailing the ruling.

"I acted on my belief that the NSA's mass surveillance programs would not withstand a constitutional challenge, and that the American public deserved a chance to see these issues determined by open courts," he wrote, according to the New York Times.

"Today, a secret program authorized by a secret court was, when exposed to the light of day, found to violate Americans' rights," he added. "It is the first of many."

Earlier on Monday, the White House rejected an amnesty for Mr Snowden.

Press secretary Jay Carney said the US government continued to press Russia - where Mr Snowden has been granted asylum - to return him to the US.

"There's been no change in our position," he told reporters.

On Sunday, Richard Ledgett, head of the NSA's task force investigating damage from Mr Snowden's leaks, discussed the possibility of an amnesty.

"My personal view is, yes it's worth having a conversation about," he told the US television channel CBS.