Image copyright NSA Image caption The NSA has come under increased scrutiny since the Snowden revelations

A US appeals court has overturned a ruling that deemed the National Security Agency's (NSA) bulk collection of phone records to be illegal.

District of Columbia judges said the plaintiffs had failed to prove they had been targeted for NSA surveillance.

Judges in a separate case in New York in May ruled the programme illegal.

It is not clear what the latest ruling means, as Congress has since passed legislation phasing out the NSA's bulk collection of Americans' records.

The agency's spying was revealed in 2013 by Edward Snowden, a former NSA contractor who has since fled to Russia.

It collected data about numbers called and times, but not the content of conversations. It also allegedly spied on European firms, as well as high-profile individuals including German Chancellor Angela Merkel.

The ruling on Friday in the District of Columbia reversed a preliminary ruling in 2013 by a lower court which said the NSA programme was "probably unconstitutional and almost Orwellian".

But judges said the case should not continue because the people that brought the case - activist Larry Klayman and the parents of an NSA employee killed in Afghanistan - fell "short of meeting the higher burden of proof required for a preliminary injunction".

Congress in June passed legislation aimed at scaling back the programme in the coming months and ending bulk collection of Americans' records.

Bulk data collection rulings

NSA phone surveillance first revealed in June 2013 by Edward Snowden

Federal judge in Washington rules in December 2013 that mass collection may be unconstitutional

A week later, a New York district judge says it is legal

House of Representatives passes bill in May 2014 to end NSA bulk collection

A few days later, President Barack Obama tells Congress to pass a bill ending the practice

Congress did so this summer, and programme will end in November

The new measures are not due to take effect until December.

The new law requires telecoms companies to store data, instead of US intelligence agencies, and to hand over any information in response to a government request approved by a secret counter-terror court.

The Snowden revelations in June 2013 caused an international outcry, despite US administrations insisting the programme had been fully authorised.