On Tuesday, a federal judge said that the government's bulk data-collection of phone and email records gathered from warrantless surveillance of foreign nationals living outside the country was legal.

Mohamed Mohamud, a U.S. citizen who lived in Oregon, was convicted of terrorism last year for his attempt to detonate a bomb at Christmas tree-lighting ceremony in Portland in 2010. However, the bomb was a fake—the purported plot was an FBI sting, Fox News reported.

Mohamud has since challenged the government citing the National Security Agency's data-collection program, which was made public by Edward Snowden, violated his constitutional rights.

But U.S. District Judge Garr King denied Mohamud's motion to dismiss his terrorism conviction.

Mohamud's attorneys argued that prosecutors didn't notify the defendant that they had received information regarding Mohamud under the U.S. Foreign Intelligence Surveillance Act until he was already convicted. They also argued that the important information was withheld from the defense team, according to Fox.

"A new trial would put defendant in the same position he would have been in if the government notified him of the [surveillance] at the start of the case," King wrote. "Dismissal is not warranted here."

Under FISA, the U.S. government is allowed to collect information about foreign nationals "reasonably believed" to be outside of the U.S., while also including the incidental collection of data from U.S. citizens in contact with people in other countries.

Mohamud reportedly had email communications with two terror suspects who were U.S. citizens -- Anwar al-Awlaki and Sami Khan -- that and were killed in drone strikes in 2011. The information was used as evidence during Mohumud's trial, Fox reported.

Additionally, Mohamud also was in contact with a friend believed to have attended a terrorist training camp in Pakistan.

King said in his ruling that Mohamud's attorneys didn't have the classified information from the prosecutors and couldn't know for sure what evidence was provided.

"This is insufficient, King said. "I realize the difficult position the defense team is in, but the denial of a [hearing] is commonplace in the FISA context."