One of the documents that Edward Snowden delivered to American journalists two years ago was a now-infamous NSA slide titled “New Collection Posture.” The slide summarizes, in surprisingly candid terms, the objective of the largest, most powerful surveillance agency on the face of the earth. ‘Collect it all’, it says.

The idea is that the NSA needs to vacuum up everything it can — because, well, one never knows what information might one day become useful. You can’t find the needles unless you have a haystack, intelligence officials say. You can’t connect the dots unless you first collect the dots. ‘Collect it all’ is a mentality, a mindset.

But ‘collect it all’ is also a legal theory and the significance of Thursday’s extraordinary ruling from an appeals court in New York is that it rejects this theory — or at least one manifestation of it. The government relies on a provision of the Patriot Act to collect the call records of hundreds of millions of Americans — the vast majority of them, needless to say, not suspected of having done anything wrong. On its face, the Patriot Act provision permits the government to collect records that are “relevant” to authorized investigations, but the government argues that everything is relevant because anything might be — one day.

Thursday’s decision rejects this argument categorically. “The interpretation the government asks us to adopt defies any limiting principle”, the court writes. To adopt it, the court observes, would permit the government to appropriate any private collection of data into a government database for future review. This, the court writes: “would be an unprecedented contraction of the privacy expectations of all Americans.”

The decision focuses on the NSA’s call-records program, but its implications are broader. This is because the same defective legal theory that underlies the call-records program is at work in some of the NSA’s other mass-surveillance programs as well. The NSA once collected the internet metadata of millions of Americans, arguing that all of the data was relevant because some of it might be. The CIA is reported to be amassing records of international financial transactions on the same theory. And, until recently, the Drug Enforcement Administration operated its own massive call-records database.

Right after the appeals court’s decision, Senator Richard Burr, the chair of the Senate Intelligence Committee, appeared to disclose that the NSA is also collecting Americans’ IP addresses in bulk, presumably in an effort to assemble a massive database documenting Americans’ activities online. As Marcy Wheeler, who first noticed the disclosure, has since pointed out, the disclosure has mysteriously disappeared from the congressional record. There’s some murkiness about precisely what Burr meant, but there’s no question that Burr’s IP-address dragnet would be an unremarkable extension of the government’s collect-it-all logic.

Thursday’s decision was about the call-records program, but the government will have to consider its implications for other programs as well, including ones that have yet to be officially disclosed to the public.

But perhaps the more immediate effect of Thursday’s decision will be on the debate now unfolding in Washington. The Patriot Act provision that underlies the call-records program is scheduled to sunset on 1 June, and over the next three weeks Congress must decide whether to reauthorize the provision, scale it back or allow it to expire. The appeals court’s decision should strengthen the hand of advocates who believe the revisions currently being considered by Congress don’t go far enough, and it should strengthen the resolve of legislators who have been pushing for more comprehensive reforms.

If Congress can’t coalesce around more comprehensive reform, the best course would be to let Section 215 expire. The intelligence community hasn’t even attempted to make a serious case that this authority is actually necessary. And as the recent ruling reminds us, it’s an authority that’s been grossly abused already and that could readily be abused again.

The court has done its part. Now it’s Congress’s turn.