PORTLAND, Ore. (AP)  A federal appeals court Monday upheld the conviction of Mohamed Mohamud, the Somali American sentenced to 30 years in prison for plotting to bomb downtown Portland during the annual lighting of a Christmas tree.

Mohamud pressed a cellphone button in November 2010, believing it would set off explosives in a van. The bomb, however, was a fake provided by FBI agents posing as terrorists.

Mohamud’s attorneys claimed the teenager was victim of entrapment, that he had neither the means nor the intent to commit domestic terrorism until he was persuaded in that direction by undercover agents.

Prosecutors said at Mohamud’s trial that the college student was on the path to radicalization, and it was only the FBI’s intervention that prevented him from committing terrorism in the U.S. or abroad.

The 9th U.S. Circuit Court of Appeals acknowledged in its 50-page opinion that the government’s conduct was quite aggressive at times, but the court said the sting operation fell short of a violation of the right to due process.

Judge John B. Owens, who wrote the opinion, pointed out that Mohamud picked the target  Pioneer Courthouse Square  and planned where the van would be parked. “Despite being provided numerous opportunities to deviate from or terminate the plan, Mohamud never displayed any reluctance in going through with a horrific attack that would have killed and maimed countless people, including young children,” Owens wrote.

In the same opinion, the court also rejected an assertion that the warrantless surveillance of Mohamud’s foreign communications violated his constitutional rights.

The surveillance was authorized by the Foreign Intelligence Surveillance Court. The law that created the secretive court allows warrantless physical and electronic surveillance of suspected terrorists.

Mohamud’s attorney challenged the trial judge’s decision not to suppress, based on tardy disclosure, information collected through the act. The Appeals Court found that Mohamud could not demonstrate prejudice, and the late disclosure was not because of prosecutorial misconduct.

The panel noted there were likely several errors regarding what evidence was allowed at trial, but determined they were “cumulatively harmless.”

Federal public defender Lisa Hay expressed disappointment with the opinion and said she expects to continue fighting on Mohamud’s behalf. “The 9th Circuit recognized that Mr. Mohamud presented a solid case for entrapment at trial. Those were their words,” Hay said.

The appeals court’s decision was also criticized by the American Civil Liberties Union. “Contrary to the court’s ruling, this sweeping surveillance violates the constitutional safeguards intended to protect Americans’ privacy,” ACLU staff attorney Patrick Toomey said.

Mohamud arrived in the United States at 3 years old. Owens wrote that Mohamud was like any other American teenager, but something changed after believing he was racially profiled by security at a London airport in December 2008. He’s serving his sentence at a California prison.

“Many young people think and say alarming things that they later disavow, and we will never know if Mohamud, a young man with promise, would have carried out a mass attack absent the FBI’s involvement,” Owens wrote. “But some ‘promising’ young people  Charles Whitman, Timothy McVeigh, and James Holmes, to name a few from a tragically long list  take the next step, leading to horrific consequences.”