A US court is for the first time considering the constitutionality of a warrantless government surveillance programme operated by the National Security Agency.

Lawyers for Mohamed Mohamud have argued that surveillance evidence used to convict the Somali-American man, found guilty of plotting to bomb a Christmas tree-lighting ceremony, was gathered in a manner that was unconstitutional.

The lawyers laid out their arguments on Wednesday before a panel of judges of the 9th US Circuit Court of Appeals in Portland, close to the plaza where Mohamud tried detonating a fake bomb that was part of an undercover operation.

Crowds at the Portland event Mohamud was convicted of trying to bomb (AP)

The Associated Press said that Mohamud is appealing his 2013 conviction on the grounds that he was entrapped by undercover federal agents posing as Al-Qaeda members and that the warrantless surveillance of his foreign communications violated his rights.

Stephen Sady, Mohamud’s lawyer, urged the court to grant his client a new trial on the grounds that the evidence used against Mohamud should never have been permitted in the courtroom.

Mr Sady told the judges that using surveillance information on foreigners, which does not require a warrant, to spy on any Americans they communicate with was “an incredible diminution of the privacy rights of all Americans… That is a step that should never be taken.”

Government lawyers defended the programme, claiming it was legal under the Foreign Intelligence Surveillance Act to access information on Americans that was obtained through foreign communications.

Edward Snowden signs up to Twitter

Lawyer Kelly Zusman said: “The query is not a search. It’s simply a means by which we access the information we have already lawfully acquired.”

A law amended in 2008 by Congress and known as Section 702, enables internet surveillance programmes known as Prism and Upstream that were first disclosed publicly in a series of leaks by NSA whistleblower Edward Snowden three years ago.

Prism gathers messaging data from Alphabet Inc’s Google, Facebook Inc, Microsoft Corp, Apple Inc and other major technology companies that is sent to and from a foreign target under surveillance. Upstream allows the NSA to copy web traffic flowing along the internet backbone located inside the United States and query that data for certain terms associated with a target.

Mohamud, a naturalised US citizen who was then 19, was found to have attempted to remotely detonate a fake car bomb planted near a square crowded with thousands of people, and sentenced to 30 years in prison.

His case challenges the admissibility of evidence brought to trial obtained under a foreign intelligence statute on grounds it does not allow the government to retain and access content of communications belonging to Americans.

The AP said that officials have conceded that data about Americans is sometimes “incidentally” collected under these programs, and later used for domestic criminal investigations. Critics see it as back-door surveillance of Americans without a warrant.