On 6 June 2013, the Guardian published a secret US court order against the phone company Verizon, ordering it on an “ongoing, daily basis” to hand over the call records of its millions of US customers to the NSA – just one of numerous orders enabling the government’s highly secret domestic mass surveillance program. Just days later the world learned the identity of the whistleblower who made the order public: Edward Snowden.

Now, almost two years later, a US court has vindicated Snowden’s decision, ruling that the bulk surveillance program went beyond what the law underpinning it allowed: the US government used section 215 of the Patriot Act to justify the program. A US court of appeals has ruled the law does not allow for a program so broad. In short, one of the NSA’s most famous and controversial surveillance programs has no legal basis.

Of Snowden and the NSA, only one has so far been found to have acted unlawfully – and it’s not Snowden. That surely must change the nature of the debate on civil liberties being had in America, and it should do so in a number of ways.

The first is the surprisingly thorny question of what to do with Snowden himself. The whistleblower is in his second year of exile, living in asylum in Russia, as he would surely face criminal prosecution should he return. The nature of the punishment – and pre-trial mistreatment – meted out to Chelsea Manning shows his fears are well founded.

But now the courts have ruled that Snowden’s flagship revelation, the very first and foremost of the programs he disclosed, has no legal basis, who now might challenge his status as a whistleblower?

Certainly not Judge Sack, who in his concurring opinion alongside today’s rulings acknowledged Snowden’s revelations led to this litigation, and likened his disclosures to Daniel Ellsberg’s famous “Pentagon Papers” leak.

If the US government seeks to jail someone who has shown its own security services acting unlawfully, its international reputation will deservedly take a beating. If the US wants moral authority to talk to other governments about whistleblowers and civil liberty, it needs to be brave: it needs to offer Snowden amnesty.

The other actions for the US executive and for Congress are broader. The court of appeals judges very deliberately chose not to consider the constitutionality of NSA bulk surveillance programs, as such questions are currently before Congress with the ongoing debate on how to reform the Patriot Act.

Congress should allow this ruling to reinvigorate that debate, and in a sense the ruling forces it to do so. If Congress want a law that allows phone surveillance on the scale of the NSA’s existing programs, it will have to explicitly create that: gone is the option of trying to push through something near the status quo with a fringe of reform.

For domestic bulk surveillance to continue and be legal, Congress must explicitly vote for it – and then, in time, the judicial branch will consider the constitutional case in earnest.

If Congress sincerely wishes to curb it, it now has substantial backing from the judicial branch to push forward and do that. Reformers finally have the jolt in the arm they needed to prevent the positive impact of Snowden’s revelations dribbling away.

The president could also use this ruling as an opportunity to consider his stance. The line endlessly aired by the administration and its officials is that all surveillance is legal. That line is no longer valid. Rather than just seeking a new script – or as is almost certain, merely appealing against the decision – this could be a great opportunity for some introspection. These surveillance programs are wildly expensive and have very few proven results. Why not look at which ones the US really needs, and whether old-fashioned targeted surveillance might not keep us all as safe (or safer), and freer too?

The final debate is one that is unlikely to happen, but should: the US needs to start considering the privacy and freedom of foreigners as well as its own citizens. The US public is rightly concerned about its government spying on them. But citizens of countries around the world, many of them US allies, are also rightly concerned about the US government spying on them.

Considering Americans and foreigners alike in these conversations would be a great moral stance – but pragmatically, it should also help Americans. If the US doesn’t care about the privacy of other countries, it shouldn’t expect foreign governments to care about US citizens. There’s something in this for everyone.

These are the debates we could be having, and should be having. The judiciary has spoken. The legislature is deliberating. The public is debating. And all of it is enabled thanks to information provided by Edward Snowden.

He should be free to join the conversation, in person.