The D.C. District Court decision this week in Klayman v. Obama, holding that the NSA's bulk telephone metadata program likely violates the Fourth Amendment, dealt a major blow to those seeking to codify the program into law. (The ACLU's challenge to the law is pending in New York, and a decision is expected any day.) Judge Richard Leon's ruling demolishes the already shaky legal foundation for the NSA's mass surveillance program, and makes it clear that reform means ending the unconstitutional suspicionless surveillance programs.

Fortunately, there's already a legislative solution for that. In late October, Rep. Jim Sensenbrenner (R-Wis.) and Sen. Patrick Leahy (D-Vt.) introduced the USA FREEDOM Act , which largely addresses Judge Leon's constitutional concerns in Klayman and refocuses law enforcement attention on stopping actual terrorist threats, not snooping on innocent Americans. But before we get there, let's quickly recount why Judge Leon ruled that the bulk collection of every Americans' call records is likely unconstitutional.

In his ruling, Judge Leon directly addressed the government and the Foreign Intelligence Surveillance Court's (FISC) opinion that U.S. persons have no privacy rights in their dialing and calling information. The government's argument rests on a 34-year-old Supreme Court case, Smith v. Maryland . In Smith, the government installed a device at a phone company for two days, without a warrant, to gain evidence on a person suspected of committing a robbery and then making harassing phone calls to the victim.

When the surveillance was challenged, the Supreme Court held that U.S. persons have no privacy interest in dialing information sent to a phone company, and police collection of that information does not implicate the Fourth Amendment. The government has been using Smith to justify warrantless surveillance of phone records ever since.

This week's decision recognizes that communications habits have drastically changed since 1979. The constant, total, years-long surveillance of every phone call made in America means the government can paint an intimate portrait of any person's associations, lifestyle, and habits whenever it queries its vast database.

Judge Leon also examined whether the government's claims that the program is essential to national security shifted the constitutional balance at all. It did not. Judge Leon could not get the government to "cite a single instance in which analysis of the NSA's bulk metadata collection actually stopped an imminent attack, or otherwise aided the Government in achieving any objective that was time-sensitive in nature."

The program's failure has been well-catalogued. Even one of the NSA's chief proponents, Senator Dianne Feinstein (D-Calif.), admitted this week that the program is not "indispensable" for the nation's security. With the Constitution on one side and little on the other, Judge Leon held that the plaintiffs are likely to win the constitutional argument against the NSA. "Indeed, I have little doubt that the author of our Constitution, James Madison, who cautioned us to beware 'the abridgement of freedom of the people by gradual and silent encroachments by those in power,' would be aghast."

The USA FREEDOM Act recognizes this and restores the constitutional balance. It ends bulk surveillance under the PATRIOT ACT. The collection of business records under the PATRIOT ACT, the pen register statute, and national security letters would be limited to only those records pursuant to an investigation of someone suspected of being a terrorist or in contact with one. By ending indiscriminate surveillance, it refocuses law enforcement energy to programs and investigative techniques that actually work to stop terrorism.

The legislation has greater privacy protections for U.S. persons when their information is incidentally collected, creates a special advocate to argue for greater privacy protections before the FISC, and has provisions to declassify its constitutionally significant rulings.

The bill isn't perfect, but it's the best chance yet at rolling back the NSA's unconstitutional surveillance program and, unlike Senator Feinstein's proposal — the FISA Improvements Act of 2013 — doesn't attempt to codify an unconstitutional program into law.

The Supreme Court may well one day rule if the government's dragnet collection of our phone records is constitutional. Congress, however, could save the nation a lot of time and reassert their role as the Constitution's protectors by passing the USA FREEDOM Act.