A federal appeals court in Manhattan Thursday struck down the government's controversial National Security Agency program to collect bulk data on Americans' telephone calls.

The Second U.S. Circuit Court of Appeals, in its 110-page ruling, became the first federal appellate panel to rule that the program was illegal, finding that it had never been authorized by Congress in legislation passed after the 9/11 attacks.

"If the government is correct, it could . . . collect and store in bulk any other existing metadata available anywhere in the private sector, including metadata associated with financial records, medical records and electronic communications (including email and social media information) relating to all Americans," wrote Judge Gerard Lynch.

EditorialEditorial: Rein in U.S. access to metadata

"Such expansive development of government repositories of formerly private records would be an unprecedented contraction of the privacy expectations of all Americans," he added.

The judges permitted the NSA program to continue temporarily as it exists, but they implored Congress to better define where boundaries exist or risk "invasions of privacy unimaginable in the past."

U.S. Attorney General Loretta Lynch said the government is reviewing the court's decision. She added that the June 1 expiration of the Patriot Act provisions provides opportunities for Congress to reauthorize the program "in a way that does preserve its efficacy and protect privacy."

advertisement | advertise on newsday

The program, which collects telephone metadata -- information on the originating and receiving number and duration of calls -- through government subpoenas to telephone companies, was first revealed two years ago in leaks by former government contractor Edward Snowden.

The government contended that compiling a huge database would make it quicker and easier for counterterrorism investigators to try to link people together in situations when information about possible plots arose.

President Barack Obama imposed limits on the use of the data in response to public uproar when the program was first revealed.

@Newsday

The law the government claims authorizes the program is up for renewal this year, and Congress is considering reforms.

The Second Circuit did not address the question of whether the data collection program, if properly authorized by Congress, would be constitutional.

The lawsuit that gave rise to Thursday's appellate ruling was filed by the American Civil Liberties Union. Jameel Jaffer, ACLU deputy legal director and lead counsel in the case, said the decision "warrants a reconsideration of all of those programs, and it underscores once again the need for truly systemic reform."

In Washington, 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.

With AP