A federal appeals court on Friday upheld the decades-long prison sentences imposed on three Twin Cities men convicted in a 2016 terror-recruitment trial, agreeing that they planned to commit murder in the name of ISIS.

A court challenge raised by the three men, whose families and supporters filled two courtrooms for oral arguments in June, failed to persuade a three-judge panel of the Eighth U.S. Circuit Court of Appeals.

Convicted following what is still considered the nation’s largest probe of terror recruitment, Mohamed Abdihamid Farah, Abdirahman Yasin Daud and Guled Ali Omar were the only three of nine defendants in the case to stand trial. Several others successfully made it abroad to join the Islamic State of Iraq and Syria between 2014 and 2015, at least three of whom are presumed dead.

Farah, 24, and Daud, 24, are serving 30-year federal prison terms. Omar, 23, was sentenced to 35 years. After a three-week trial before Senior U.S. District Judge Michael Davis in Minneapolis, jurors convicted all three on charges that included conspiring to murder abroad and conspiracy to provide material support to ISIS.

Writing for the appellate court, Judge Raymond Gruender cited “compelling testimony” from co-conspirators and recordings from an FBI informant among the “overwhelming evidence” that the three intended to follow others to the battlefield to fight, and kill, for ISIS.

Attorneys for the men argued that Davis was wrong not to instruct jurors on a defense theory that the men were motivated by a desire to prevent the atrocities of Syrian President Bashar Assad.

“Even assuming that Farah and Daud sought to join [ISIS] out of a desire to protect innocent civilians, they never discussed killing in the context of defending individual Syrian civilians who faced an immediate and specific threat,” Gruender wrote. “Indeed, their purported justification pertained only in the most general terms to the Syrian civil war and civilian suffering.”

Farah and Daud also argued that Davis should have asked jurors to determine only whether the men had a “specific intent to kill” in mind when they tried to leave the country. Davis instructed jurors that they could also convict the men of a murder conspiracy if they concluded that they intended “willfully to act in callous and wanton disregard” of human life.

“Which in this case means that simply joining ISIS inevitably makes a person liable for murder,” Glenn Bruder, Omar’s attorney, said Friday. “Congress couldn’t have intended that outcome or they wouldn’t have bothered to make aiding a terrorist organization a separate offense. I think this was a serious argument, and the Eighth Circuit dismisses it in a paragraph.”

Daud’s attorney, Bruce Nestor, called the decision “an injustice,” saying that the court “effectively replaced the role of the jury in finding the defendants guilty even if the judge’s jury instructions were wrong. In addition, some factual findings of the court, such that some defendants were eager to carry out an ISIL attack in the United States, are demonstrably false. Mr. Daud will pursue further appeals.”

In rejecting the appeals, the court relied on secret recordings made by FBI informant Abdirahman Bashir and lengthy trial testimony from Abdullahi Yusuf — who was stopped from leaving the United States in May 2014 and later cooperated with authorities — about how each man had affirmed their desire to kill in Syria.

The three also challenged Davis’ decision to impose more severe sentences on them than on the other six defendants, who avoided trial by pleading to lesser charges. Yusuf has been out of federal custody since November 2017, and Abdirizak Warsame, the other defendant who testified against his former friends, is now in a federal halfway house after less than two years in prison. The other four who pleaded guilty are serving 10-year prison terms.

But on Friday, Gruender pointed out that Davis actually sentenced the three men well below the lifetime prison sentence that was possible for them. The need to avoid “unwanted disparities” in sentencing refers to similar defendants across the country and not co-conspirators who may not have been convicted of the same charges, he added.

The court also rejected arguments by Farah that Davis should have granted him a new attorney on the eve of trial. Farah was at the center of a dramatic episode when another attorney withdrew after prosecutors disclosed possible testimony about a member of Farah’s defense team once delivering a sermon about how to pray on the battlefield.

Davis refused to substitute Farah’s other attorney, Murad Mohammad, just before trial, based on his prior insistence that Farah was confident in Mohammad and that Mohammad was prepared for trial.

Jordan Kushner, an attorney for Farah, said Friday he would discuss the decision next week with his client, who is being held in Arkansas. “My reaction is disappointment the court did not seem to consider facts that I believed were critical to the issues presented,” he said.

It was the first time the appeals court has taken up a case involving ISIS recruitment in Minnesota. In 2015, the court rejected a pair of arguments from three Minnesotans — also sentenced by Davis — convicted of supporting al-Shabab, a designated terrorist group fighting in Somalia.