It has been a great week for the U.S. Constitution and American citizens’ privacy. First, a federal judge ruled on Monday that the National Security Agency’s indiscriminatory collection of millions of Americans’ telephone records likely violates the U.S. Constitution’s ban on unreasonable search. Then, on Wednesday, a presidential advisory panel recommended sweeping changes to the NSA.

We commend U.S. District Court Judge Richard Leon for making this obvious ruling, and we urge other judges, and ultimately the Supreme Court, to rule similarly. We also urge President Barack Obama to take the advice of his advisory panel.

The collection program was disclosed by former NSA systems analyst Edward Snowden, provoking a heated national and international debate this year.

And while Leon’s injunction applies only to two individual plaintiffs — who had challenged the program and said any such records for the men should be destroyed — the ruling is likely to open the door to much broader challenges to the records collection and storage.

As Leon ruled, James Madison would be appalled at what the NSA has been allowed to do.

“I have little doubt that the author of our Constitution, James Madison, who cautioned us to beware ‘the abridgment of freedom of the people by gradual and silent encroachments by those in power,’ would be aghast,” Leon declared.

In his 68-page, heavily footnoted opinion, Leon concluded that the government didn’t cite a single instance in which the program “actually stopped an imminent terrorist attack.” But that’s beside the point, which is that the U.S. Government is infringing on its citizens’ rights — and that should be the end of the discussion.

The mere consideration of rolling back the government’s vast surveillance powers marks a psychological shift for a nation that was set on edge by the terror attacks on Sept. 11, 2001. President George W. Bush faced little resistance from Congress when he implemented the USA Patriot Act, the law Congress approved that covers the surveillance programs. And opinion polling at the time indicated Americans were broadly willing to give up privacy for the sake of security.

But parts of the program have always been unconstitutional, and we’re glad public opinion is shifting. This should also add pressure for Congress and the President to enact change. (Which appears to be happening, as the President suggested on Friday that he may be ready to reel in the NSA.)

Leon calls the collection of phone metadata “Orwellian,” which is a scary but fair comparison. We urge the President to follow through, and we hope judges do the same.