Finally. A court has examined the National Security Agency program that systematically maintains records of all Americans’ phone calls.

Judge Richard J. Leon of the District of Columbia has decided the snooping most likely violates the constitutional ban on unreasonable search and seizure, describing its technology as “almost Orwellian.” The judge then invoked James Madison, the father of the Constitution, to say that he would be “aghast” to learn of such government encroachment upon liberty.

The government says the surveillance is necessary to protect Americans. But the judge’s ruling raises a key question: At what cost?

Leon ordered the government to stop collecting data on the personal calls of the two plaintiffs in the case and to destroy the records of their calling history. But because of national security interests and the constitutional issues involved, he also stayed his ruling to allow the government time to appeal. He said it could take at least six months.

Revelations of these privacy-bending government tactics, including the phone records program, come from former NSA contractor Edward J. Snowden.

If you believe that the NSA’s activities are the necessary price of keeping us safe from terrorist threats, then the data collection is probably not a major concern. However, the agency’s penchant for collecting sweeping amounts of information both near and far is profoundly unsettling, with endless possibilities for abuses.

The government’s responsibility to keep Americans safe has to be measured against citizens’ right to privacy. The difficulty is in finding the proper balance between safety and privacy. Leon’s ruling offers an opportunity to air the complex issues before a final decision is reached, possibly by the Supreme Court.

The case is the first in which a federal judge who is not on the Foreign Intelligence Surveillance Court has examined the bulk data collection on behalf of someone who is not a criminal defendant. The case was brought by several plaintiffs and led by Larry Klayman, a conservative legal activist whose stated desire is to turn the case into a class action on behalf of all Americans.

Klayman’s outrage over the government’s bulk collection of telephone metadata, information on who is calling whom and for how long, is shared by many.

The agency’s scope and depth in gathering information has demanded a national discussion.

How much freedom are we willing to sacrifice in the name of safety? But also, is the program effective, and is it the best way to protect Americans?

Now that the case has reached the courts for a thorough airing, the public should have the information needed to make an informed decision.