A US federal judge has ordered the NSA to stop collecting the mobile phone records of innocent American citizens – and to destroy the files already amassed.

Whistleblower Edward Snowden revealed in June that the controversy-hit spy agency harvests call metadata from telco giant Verizon – sparking a lawsuit by lawyer Larry Klayman and fellow campaigners against the Obama administration.

The plaintiffs claimed the widespread gathering of phone records is unconstitutional.

In today's bombshell ruling in the case, district of Columbia Judge Richard J Leon described the mass surveillance as "almost Orwellian", indiscriminate and an "arbitrary invasion". He agreed to put in place an injunction that will halt the collection of bulk mobile phone data by intelligence agencies. The US government was granted time to appeal to a higher court, if it so desires.

The case centers on the millions of private customer records that the NSA slurps from US carriers. The spy agency – supposedly operating under a secret oversight court The Reg discussed in 2006 – said it stores the information just in case it is needed in a hurry in future investigations. This data includes when a call was made and to whom.

"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 noted in his judgment before granting the injunction.

"I am not convinced at this point in the litigation that the NSA's database has ever truly served the purpose of rapidly identifying terrorists in time-sensitive investigations.

"The government, in its understandable zeal to protect our homeland, has crafted a counterterrorism program with respect to telephone metadata that strikes the balance based in large part on a thirty-four-year-old Supreme Court precedent, the relevance of which has been eclipsed by technological advances and a cell-phone-centric lifestyle heretofore inconceivable.

"In the months ahead, other courts, no doubt, will wrestle to find the proper balance consistent with our constitutional system."

The decision is an early victory for the civil rights groups that have come together to challenge the NSA-led surveillance programs. The agency pressures mobile carriers and web companies to hand over customers' private records in large batches, or simply taps into global communications links to collect data.

Ex-NSA contractor Snowden, today living in exile in Russia, hailed the judge's decision to issue the injunction.

"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," Snowden said in a statement distributed 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. It is the first of many."

The case is among the many challenges being lobbed at the NSA for operating planet-wide electronic dragnets. Critics allege that the collection of data is violating the privacy of billions of innocent people around the world and is amounting to intimidation of many religious and advocacy groups. ®