Federal judges ruled Thursday that the National Security Agency's bulk phone data collection program is illegal. The 2nd U.S. Circuit Court of Appeals, in New York City, said that the program was outside of what Congress authorized in Section 215 of the Patriot Act, the Hill reported.

The three-judge panel also decided Thursday that a lower-court judge was wrong to dismiss the case about the NSA program's constitutionality. It did not rule on whether the NSA program violated the Constitution, Reuters reported.

"If the government is correct, it could use § 215 to 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 e‐mail and social media information) relating to all Americans," Judge Gerard Lynch wrote. "Such expansive development of government repositories of formerly private records would be an unprecedented contraction of the privacy expectations of all Americans."

Read the full opinion here.