More than seven years after President George W. Bush signed a law authorizing warrantless surveillance of international communications, a federal appellate court heard arguments challenging the 2008 law for the first time.

Congress passed the FISA Amendments Act in the wake of revelations that the Bush administration was wiretapping all Americans’ transnational communications. Rather than reining in the program, Congress effectively legalized it – providing legal immunity to the phone companies involved and allowing the government to conduct surveillance without a court order, as long as the “target” was a foreigner living overseas.

In 2013, documents leaked by NSA whistleblower Edward Snowden revealed that the government cites the law as the legal authority for its PRISM and Upstream programs, which collect Americans’ emails and browsing histories with individuals and websites hosted overseas.

Courts have previously dismissed multiple lawsuits by the ACLU and Electronic Frontier Foundation that challenged electronic mass surveillance, ruling that the plaintiffs lacked standing to sue because they could not prove their communications were being collected by the NSA’s secret programs.

But on Wednesday, lawyers for the ACLU and Electronic Frontier Foundation argued as “friends of the court” before an appellate court in Oregon, challenging NSA surveillance in the case of Mohamed Mohamud. Mohamud, a Somali-born, naturalized American citizen, was convicted in 2012 for trying to bomb a Christmas tree lighting ceremony in downtown Portland in 2010.

The FBI had used the NSA’s databases to monitor Mohamud, but despite repeated requests from the defense, the government withheld information about warrantless surveillance during discovery. The Department of Justice only provided notice of special surveillance after Mohamud was convicted.

In ordinary cases, the prosecution is required to provide notice to the defense about the types of searches and surveillance conducted on the defendant, thereby allowing the defense to cross examine the investigative methods and to question whether they are legal or constitutional. Despite being required by law to disclose use of evidence obtained under the FAA in a criminal case, the government has only provided this type of notice on a small number of occasions.

Lawyers from the ACLU argued on Wednesday that the government was using NSA surveillance to circumvent the defendant’s right to privacy and failing to provide notice in order to prevent the defense from challenging its constitutionality.

“The government is using FAA surveillance to bypass the Fourth Amendment rights of communications, while amassing a huge database of their private communications,” said Patrick Toomey, a lawyer for the ACLU’s National Security Project.

“In justifying the surveillance, the government is saying, ‘Look, we’re targeting foreigners,’ while at the same time FBI agents around the country are querying this database for the communications of specific Americans, just as the FBI has done in this case,” said Toomey.

Kelly Zusman, an appellate lawyer for the government, responded that FISA “provided the types of protections that are ultimately reasonable under the Fourth Amendment,” because the NSA’s internal “targeting procedures require that the NSA analysts do due diligence that foreign intelligence information will be found.”

When a member of the panel pointed out that Zusman was defending NSA surveillance without judicial approval, Zusman argued the secret Foreign Intelligence Surveillance Court conducts “rigorous oversight at the back end” on an annual basis, and Congress does the same on a semiannual basis.

But in reply, Toomey argued, “The fact that the government didn’t even go to a court for individualized approval of its query focused on the defendant … is enough of a defect to make the surveillance unlawful.”

While Mohamud’s case represents the first time an appellate court heard arguments challenging the FISA Amendments Act, it is not the first case in which the government has tried to cover up the use of NSA databases in criminal prosecutions.

When the Supreme Court dismissed an earlier ACLU lawsuit in 2013 – ruling that plaintiffs lacked standing to sue – the court’s ruling was based on an assurance from Solicitor General Donald Verrilli, the government’s top lawyer. Verrilli promised the court that while the plaintiffs lacked standing to sue, the FAA could still be challenged by criminal defendants who had received notice of special surveillance.

But Verrilli’s assurance was suspect even at the time. When the case was argued in 2012 – more than four years after the FISA Amendments act was signed – no defendant had ever received notice of NSA surveillance. The government’s deception was inadvertently exposed by Sen. Dianne Feinstein, D-Calif., who revealed its use in criminal proceedings while advocating for reauthorization of the surveillance law. Speaking on the floor of the Senate, Feinstein said that for “some” of the 16 people arrested for terrorism that year, “the information came right from this program.”

After the New York Times pointed out that the government had violated the law, the Department of Justice provided notice to five criminal defendants over the following year.

In his book Power Wars, Charlie Savage reported that the DOJ’s notification policy caused a fierce debate within the administration. He wrote that Solicitor General Donald Verrilli called an interagency meeting to find out if he had deceived the Supreme Court and iron out a policy for notification. According to Savage, when he asked the room if anyone thought that failing to provide notification was lawful, no one spoke up.

If the court rules that the evidence is inadmissible, it could set a strong precedent that surveillance must be approved in order for it to serve as evidence at trial. The court could possibly even reach a decision on whether the FISA Amendments Act is constitutional, but that is less likely.

Top photo: Activists protest the surveillance of U.S. citizens by the NSA outside the Justice Department in January 2014.