Civil rights attorneys say surveillance evidence used to convict a Somali-American man who plotted to bomb a Christmas tree-lighting ceremony was unconstitutionally gathered through the U.S. government's warrantless foreign surveillance program.

Mohamed Mohamud admits that he tried tried detonating a fake bomb in downtown Portland in 2010. He was convicted in 2013.

But he says he was entrapped by undercover federal agents posing as al-Qaida members who provided the fake bomb and spied on his electronic communications through the program.

It's the first federal challenge to the National Security Agency's foreign surveillance program, scrutinized after the Edward Snowden leaks.

U.S. prosecutors defended the program in a federal appellate courtroom Wednesday, saying it allows information gathering without a warrant on Americans who communicate with foreigners whose names appear in NSA databases.