Army Sgt. Bowe Bergdahl, the U.S. soldier who faces court-martial on a charge of desertion after walking away from his base in Afghanistan and spending five years in militant captivity, sought and failed to receive a presidential pardon by President Barack Obama before he left office, according to Bergdahl’s attorney Eugene Fidell.

The attorney acknowledged the effort Friday after Berghdahl’s legal team filed a new motion to dismiss the Army’s case against their client, citing past harsh rhetoric against Bergdahl by newly sworn-in President Trump. The New York Times previously reported the pardon effort was considered, but Bergdahl’s legal team declined to discuss it at the time.

“We had hoped that [Obama] would grant a pardon. He didn’t,” said Fidell, calling the issue is a “highly discretionary matter” for a president. The White House, he said, opted to not respond to the request.

On the campaign trail, Trump repeatedly called Bergdahl a “dirty, rotten traitor” to his country and suggested that if he had acted the way he did 25 or 50 years ago, Bergdahl would have been executed by the military. In reality, the United States has executed an accused deserter only once since the Civil War, and not at all since World War II.

Bergdahl’s legal team said Trump’s comments deny their client “the due process right to a fair trial” and constitute apparent unlawful command influence, in which a senior U.S. official meddles in a military justice case while seeking a specific outcome.

Obama issued 1,715 commutations to federal prisoners during his administration, surpassing the combined total of his 12 predecessors, and an additional 212 pardons. Among those whose sentences were commuted was Chelsea Manning, the former U.S. soldier who served just short of seven years of a 35-year sentence for for leaking thousands of classified documents to anti-secrecy website Wikileaks when she was deployed to Iraq as an intelligence analyst.

Manning’s commutation prompted speculation that Bergdahl also could receive legal relief from Obama. The soldier faces charges of desertion and misbehavior before the enemy for leaving his patrol base in eastern Afghanistan in June 2009 in what he characterized as an attempt to draw attention to problems he saw in his unit. Bergdahl was captured within hours, smuggled over the border into Pakistan and remained in captivity until the Obama administration negotiated a trade in May 2014 in which it released five Taliban detainees.

The trade was decried by critics, even after it was disclosed that military physicians determined Bergdahl suffered from a mental disorder that causes psychotic episodes. Obama defended the deal, saying that the United States does not leave soldiers behind “regardless of the circumstances.” Fidell said that Bergdahl will be grateful to Obama “for the rest of time” and believes that he saved his life.

The decision means that Bergdahl still faces a potential sentence of up to life in prison if he is convicted at a trial scheduled to begin this spring. Army prosecutors have argued that, at minimum, he endangered the lives of the many U.S. troops who were ordered to search for him after his disappearance.

An Army investigation completed after he was recovered in 2014 found no evidence that a service member was killed or wounded as a direct result of those searches, but soldiers serving in Afghanistan at the time have more recently testified about a specific mission July 8, 2009, in which an Army National Guardsman, Sgt 1st Class Mark Allen, was shot in the head during a firefight on a mission they said was ordered specifically to search for Bergdahl. Another soldier suffered hand injuries from a rocket-propelled grenade in the same fight.

Bergdahl’s lawyers made a motion with the U.S. Court of Appeals for the Armed Forces last fall to to request an expedited hearing for two issues in the soldier’s case, saying Trump’s continued attacks threatened Bergdahl’s right to fair consideration by the top officer overseeing the case, Army Gen. Robert Abrams, and in any subsequent court-martial.

On Friday, Bergdahl’s legal team also released a new 28-minute video that collects many of the instances that Trump criticized Bergdahl and the trade Obama made and said he was happy that they “knocked the crap outta him” while he was in captivity.

“The only question was when — not whether — the candidate would get around to him,” the new motion states of Trump’s penchant of criticizing Bergdahl. “President Trump transformed his rallies into a televised traveling lynch mob.”

Sean Spicer, a spokesman for Trump, did not respond to a request for comment.