A US appeals court has ruled that bulk collection of phone records by the National Security Agency is illegal.
Overturning a 2013 ruling, the judges did not, however, halt the programme but urged Congress to take action.
The NSA’s spying was leaked by Edward Snowden, a former NSA contractor who has since fled to Russia.
The NSA has collected data about numbers called and times, but not the content of conversations. It also allegedly spied on European firms.
Among individuals targeted was German Chancellor Angela Merkel
The latest verdict, by The 2nd US Circuit Court of Appeals in New York, came after New York District Judge William Pauley had dismissed a legal challenge by the American Civil Liberties Union (ACLU) which argued that the way the NSA tracked million of calls contravened the US constitution.
The 97-page ruling says that “a provision of the USA Patriot Act permitting the Federal Bureau of Investigation to collect business records deemed relevant to a counterterrorism investigation cannot be legitimately interpreted to permit the systematic bulk collection of domestic calling records”.However, the appeals court stopped short of ruling on the constitutionality of the programme, which is set to expire on 1 June.