Hamza Naj Ahmed knew that ISIL was a terror organization, he told a judge in federal court Monday, but its slick social media messaging convinced him its cause was a righteous one.

Watching online videos, he came to believe that ISIL was "helping the innocent people, similar to government organizations," Ahmed said as he entered a guilty plea to charges that he conspired to go join the Islamist group.

With just two weeks left before the start of a major federal terrorism trial, Ahmed became the sixth defendant to plead guilty in the yearlong investigation into recruitment of young Somali-Americans. His appearance marked the second late plea deal this month made possible by the revelation that a local imam and legal adviser may have interfered with his and others' cases.

Given a new a chance to avoid the May 9 trial, Ahmed told U.S. District Judge Michael Davis that stories of women and children suffering under the Syrian regime captured his attention even as he watched videos of mass executions of prisoners produced by the same group, the Islamic State of Iraq and the Levant (ISIL).

"I would say the [social] media was a very critical aspect of it," he said.

The plea by Ahmed, 21, came 11 days after another defendant, Adnan Farah, took a similar deal after prosecutors said they had new evidence of interference with the men's cases as they considered previous plea offers last year.

Though prosecutors didn't name who allegedly interfered with Farah, another attorney disclosed last month that Hassan Mohamud — a St. Paul imam who helped advise the defense team of Farah's brother — tried to dissuade his client from pleading guilty on the eve of a September hearing. The attorney also disclosed that his client, Zacharia Abdurahman, had agreed with co-defendants Farah and Ahmed that accepting plea deals was the best choice.

That new evidence has led the government to take the rare step of dropping charges of conspiracy to murder abroad against Ahmed and Farah added in a new indictment in October.

'Idealistic, youthful choices'

Ahmed, arrested months before six others were charged last April, pleaded guilty Monday to conspiracy to provide material support to ISIL and federal financial aid fraud for using student loan money to pay for his attempted travel. He faces up to 20 years in prison, and Davis ordered him to undergo an evaluation as part of the court's new terrorism disengagement and deradicalization program.

"I'm gratified that the government re-extended a plea offer to him so we can focus on sentencing and make sure his life is not derailed by his idealistic and youthful choices," attorney JaneAnne Murray said.

Ahmed admitted Monday to devising plans with six others to go to Syria in spring 2014. He said he planned to use his financial aid money to buy a Greyhound bus ticket to New York, and a plane ticket to Istanbul, whose border with Syria he intended to cross.

Ahmed and three others from the group made it as far as New York in June 2014, but federal agents stopped them before they left the ground. Throughout the plot, he said, the men motivated each other by debating ISIL's ideology.

"We talked about going over there to help any way we could," he said.

Notice for Ahmed's plea hearing on Monday was filed less than two hours before he appeared in court — much like Farah's April 14 hearing, sources said, because of concerns about further outside interference with the defense.

Wearing orange jail-issued sweats, Ahmed had to lower himself toward a microphone to answer questions from Davis. The judge repeatedly asked him if anyone — including a "sheikh or imam" — had kept him from accepting a previous plea offer.

Ahmed said that before he was to discuss a plea offer with Murray that month, his mother abruptly changed her opinion and advised him to go to trial. But Ahmed could not identify who talked to his family because he had "very limited contact" while in jail.

"Your mother was talking to someone," Assistant U.S. Attorney John Docherty said.

"That's the only thing that makes sense," Ahmed said.

The latest plea deal would leave three defendants — Mohamed Farah, Guled Omar and Abdirahman Daud — to stand trial on charges including conspiracy to murder abroad and conspiracy to provide material support to a designated foreign terrorist organization.

Charges were filed against 10 young Somali-American men from the Twin Cities after a yearlong federal probe.

Farah, Omar and Daud are scheduled to be in court Tuesday for a hearing on numerous motions ahead of their May 9 trial. Davis issued orders on several requests Monday afternoon, including allowing prosecutors to present evidence of 2012 attempts by Omar to join Al-Shabab in Somalia and an order denying defendants' ability to argue that they were traveling to Syria in defense of others or that they believed their combat with ISIL would have been lawful.

Twitter: @smontemayor