A three-judge panel of the 2nd U.S. Circuit Court of Appeals in Manhattan permitted the National Security Agency program to continue temporarily as it exists, but all but pleaded for Congress to better define where the boundaries exist.
"In light of the asserted national security interests at stake, we deem it prudent to pause to allow an opportunity for debate in Congress that may (or may not) profoundly alter the legal landscape," said the opinion written by Circuit Judge Gerald Lynch.
"If Congress decides to authorize the collection of the data desired by the government under conditions identical to those now in place, the program will continue in the future under that authorization," the ruling said. "If Congress decides to institute a substantially modified program, the constitutional issues will certainly differ considerably from those currently raised."
The appeals judges said the issues raised in a lawsuit by the American Civil Liberties Union illustrated the complexity of balancing privacy interests with the nation's security.
A lower court judge in December had thrown out the case, saying the program was a necessary extension to security measures taken after the Sept. 11, 2001, terror attacks. The appeals court, which heard two hours of arguments, said the lower court had erred in ruling that the phone records collection program was authorized in the manner it was being carried out.
During the December arguments, the judges said the case would likely be decided ultimately by the U.S. Supreme Court.
The NSA's collection and storage of U.S. landline calling records — times, dates and numbers but not content of the calls — was the most controversial program among many disclosed in 2013 by former NSA systems administrator Edward Snowden. Some NSA officials opposed the program, and independent evaluations have found it of limited value as a counterterrorism tool. Snowden remains exiled in Russia.
A spokeswoman for government lawyers in New York declined to comment Thursday.
The ACLU did not immediately respond to a request for comment.
The court's ruling sharpens the focus on the ongoing congressional debate about whether to end NSA's collection of phone records as part of a Patriot Act reauthorization. The provisions that authorize the phone records program are among those that expire June 1.
Republicans and Democrats in the House have agreed on a bill to end the government's bulk collection of the records, but Senate leaders are backing a competing measure that would maintain the status quo. One of the sponsors, intelligence committee chairman Richard Burr, has said he is open to a compromise, however.
The divisions on the issue don't run neatly along partisan lines. Libertarian-leaning Republicans have joined many Democrats in arguing that a secret intelligence agency should not be storing the records of every American phone call, even if the data is only examined under limited circumstances. Some Democrats and Republicans assert that the program is needed now more than ever, given the efforts by the Islamic State group to inspire extremists to attack inside the U.S.
The House Judiciary Committee last month overwhelmingly passed the latest version of a bill known as the USA Freedom Act. The measure seeks to codify President Barack Obama's proposal to end the NSA's collection and storage of the phone records. Instead, it would allow the agency to request records held by telephone companies under a court order in terrorism investigations.
Under that proposal, the NSA might end up with access to even more data. As it stands, the program doesn't collect data on most mobile calls, but under a new arrangement, the NSA could request mobile records as needed from phone companies.
The 2nd Circuit noted that telephone metadata includes a call's length, the phone number from which it was made and the phone number called.
Opponents of the program say the information can enable the government to learn, for instance, whether someone has called a domestic violence, rape or suicide hotline or whether someone has reported a crime. They say it can also reveal civil, political or religious affiliations, an individual's social status and whether the person is involved in an intimate relationship.
Dilanian reported from Washington.