The US government has suffered a symbolic defeat in its quest to justify the bulk collection of telephone data of American citizens for national security purposes. A federal court judge's ruling that the National Security Agency's actions are "significantly likely" to be unconstitutional provides important firepower for opponents of secretive surveillance programmes that have flourished unfettered since the terror attacks of September 11, 2001. Authorities, as in any country, should protect their citizens and national interests against internal and external threats. But it has to be done in a way that does not erode or destroy the right to privacy.

District of Columbia federal court judge Richard Leon contended that the phone data collection programme introduced in 2006 and repeatedly reauthorised by a secret court did not appear useful. No single instance had been given by the government to prove that the collection of tens of millions of records "actually stopped an imminent attack", he said. Until Monday's ruling, 15 different judges of the Foreign Intelligence Surveillance Court had determined on 35 occasions that the agency's phone data collection programme was legal. A California federal judge last month rejected an attempt to restrict the agency's activities on the grounds that the expectation of privacy could not include phone data.

The ruling has been stayed by the judge so that the government can appeal and, if it stands, will affect only the plaintiffs, who are led by a civil activist. A similar case is before a federal court in New York. But whatever the outcomes, the fact that the government's lawyers were challenged in open court changes the nature of the discussion. More people will be emboldened to take on authorities to protect basic rights.

Such challenges would have been unthinkable six months ago before former NSA contractor Edward Snowden revealed the extent of the agency's eavesdropping. The judge's ruling moves the debate in a welcome direction towards balancing the need for protection and the need for privacy.

This article appeared in the South China Morning Post print edition as Judge changes spying debate