FORT BRAGG, N.C. — A military court has agreed to hear an appeal by a U.S. Army soldier who left his post in Afghanistan and was held prisoner by the Taliban for five years.

The Fayetteville Observer reported Thursday that the court will examine whether statements by President Donald Trump and the late U.S. Sen. John McCain unfairly influenced Bowe Bergdahl's trial.

Bergdahl's lawyers argue that McCain threatened to conduct a hearing at the Senate Armed Services Committee if Bergdahl went unpunished. The lawyers also cite multiple instances of Trump making disparaging comments about Bergdahl.

People in the military's chain of command are forbidden from saying anything that could interfere with a military court case.

Bergdahl, a Hailey native, pleaded guilty in 2017 to desertion. He was spared prison time but was dishonorably discharged as a private.

RELATED: Bergdahl sentenced to no prison time, dishonorable discharge

RELATED: Psychiatrist: Bergdahl suffered from mental disorders before joining Army

RELATED: Analysts: Bergdahl provided 'gold mine' of information after release

RELATED: Bergdahl: Leaving Afghanistan outpost was 'horrible mistake'

RELATED: Military judge denies motion to toss out Bergdahl case

RELATED: Serious head and hand wounds described by Bergdahl searchers