BRUSSELS — The European Union's top court on Tuesday dealt a blow to law-enforcement agencies' spying on phone and internet records, saying the lives of citizens should not be "the subject of constant surveillance."

The European Court of Justice scrapped EU legislation allowing the indiscriminate collection of such communication data in crime-fighting efforts, finding that the rules were too broad and offered too few privacy safeguards.