The National Security Agency (NSA) campus in Fort Meade, Md. (Patrick Semansky/Associated Press)

FOR MONTHS, Congress has debated the National Security Agency’s telephone metadata collection program, without legislative result. Now two factors have combined to make that frustrating situation even less sustainable. The legislative authority that first the George W. Bush administration and then the Obama administration cited for the program, Section 215 of the Patriot Act, is expiring on June 1. And, on Thursday, the U.S. Court of Appeals for the 2nd Circuit ruled that their interpretation of Section 215 was wrong anyway.

Congress needs to respond, and the sooner the better. To be sure, the court’s ruling has no immediate practical impact, since the three-judge panel considered it superfluous to stop the program less than a month before Section 215 expires. The court’s reasoning, though, could, and should, influence the debate. Judge Gerard E. Lynch’s opinion noted that the NSA’s mass storage of data, basically just in case it should be needed for a subsequent inquiry, stretched the statute’s permission of information-gathering “relevant to an authorized investigation” beyond “any accepted understanding of the term.”

Intelligence and law enforcement must be able to gather and analyze telephone metadata, but that requirement of national security can, and must, be balanced by robust protections of privacy and civil liberties. Under the current system, those protections consist of the NSA’s own internal limitations on access to the database, subject to supervision by the Foreign Intelligence Surveillance Court (FISC) — which operates in secret and considers arguments only from the government. A democratic society requires more explicit, transparent protections.

There is, fortunately, a promising reform proposal readily available: the USA Freedom bill, which enjoys bipartisan support in both chambers as well as broad endorsement from President Obama — and the affected private industries as well. In a nutshell, it would abandon the bulk collection of the NSA’s metadata, and warrantless searches of it, in favor of a system under which telecommunications firms retained the information, subject to specific requests from the government. Those queries, in turn, would have to be approved by the FISC. Along with the bill’s provisions mandating greater disclosure about the FISC’s proceedings, the legislation would go a long way toward enhancing public confidence in the NSA’s operations, at only modest cost, if any, to public safety.

The measure has passed the House Judiciary Committee by a vote of 25 to 2. In the Senate, it failed to muster 60 votes last year when Democrats were in the majority, and its prospects appear even dimmer now that the Republicans are in control; their leader, Sen. Mitch McConnell (Ky.) favors reauthorizing Section 215 as-is.

Mr. McConnell’s view — that the statute does, indeed, authorize bulk metadata collection — was legally tenable, barely, before the 2nd Circuit’s opinion. Now he should revise it. If the Senate renews Section 215 at all, it should only be a short-term extension to buy time for intensive legislating after June 1 — with a view toward enacting reform promptly. If the anti-terrorism effort is to be sustainable, Congress must give the intelligence agencies, and the public, a fresh, clear and, above all, sustainable set of instructions.