BOSTON (AP) — A deluge of terror-related images used by prosecutors scared jurors and influenced them to convict a Massachusetts man of trying to help al-Qaida, the man's lawyer argued to a federal appeals court Tuesday.

Tarek Mehanna of Sudbury was sentenced to 17 1/2 years in prison after being convicted in 2011 of four terror-related charges and three charges of lying to authorities.

During Mehanna's trial, prosecutors said he traveled to Yemen for training in a terrorist camp and intended to go on to Iraq to fight U.S. soldiers. When that plan failed, Mehanna returned to the United States and disseminated materials online promoting violent jihad, prosecutors said.

In arguments before the 1st U.S. Circuit Court of Appeals, Mehanna's lawyer, Sabin Willett, said prosecutors showed 28 images of the World Trade Center in flames on Sept. 11, 2001, and numerous terror-related videos and repeatedly made references to Osama bin Laden in an attempt to prejudice the jury against Mehanna.

"The purpose of this evidence was to frighten the jury," Willett said, "and it worked."

But a Justice Department lawyer said the images demonstrated Mehanna's ideology, including a need he felt to help al-Qaida. Liza Collery said the evidence was used to show what Mehanna's beliefs originally were, how he became radicalized and how he became involved in creating jihadist "propaganda."

Collery said Mehanna portrayed himself as a "scholarly man in search of enlightenment" when he traveled to Yemen, but the evidence contradicted that claim, including a transcript of a recorded conversation with a friend in which Mehanna said he was deeply disappointed he was not able to find al-Qaida operatives while he was in Yemen.

Justice Bruce Selya questioned Collery extensively about whether the amount of terror-related images presented by prosecutors was cumulative and prejudicial, saying the argument from Mehanna is that the "government grossly overdid it."

"Terrorism sparks emotions in all of us. It's a particularly heinous crime," Selya said, later adding, "This is a hard case."

Collery said the trial judge considered and then rejected the notion that the government was piling on with the number of images it presented.

The three-judge panel gave no indication on when it will issue its ruling. Typically, the court issues its rulings within four months after oral arguments.

Dozens of Mehanna's supporters attended the hearing. Mehanna's father, Ahmed, said afterward he is hopeful.

"I hope justice will be served at that level of the court," he said, referring to the appeals courts.

Prosecutors said Mehanna lived a double life, appearing as a scholarly young man to his family and community, but actually was someone who advocated violence to achieve political goals.

Mehanna's lawyers said that Mehanna did not provide any tangible support, such as money or weapons to al-Qaida, and that his online activities were protected by the First Amendment right to free speech.

Join our Newsletter for the latest news right to your inbox