U.S. Army Sergeant Bowe Bergdahl, charged with desertion in Afghanistan, wants the case against him dismissed, saying he cannot get a fair trial now that Donald Trump, who has called him a traitor, is president, according to a court motion filed on Friday.

Lawyers for Bergdahl, 30, submitted the motion on the day that Trump took the oath of office as 45th president of the United States on the steps of the U.S. Capitol in Washington.

The soldier, who spent five years as a prisoner of the Taliban in Afghanistan after walking off his post, faces a court-martial on charges of desertion and endangerment of U.S. troops.

The court-martial, which could result in a life sentence for Bergdahl, is scheduled to begin on April 28.

Lawyers for Bergdahl submitted as evidence a 28-minute video showing Trump repeatedly calling Bergdahl "a no-good traitor" during various presidential campaign appearances, and suggesting the soldier should be shot or dropped from an airplane into Afghanistan.

"President Trump has made it impossible for SGT Bergdahl to obtain a fair trial," said the motion filed in the Second Judicial Circuit, U.S. Army Judiciary at Fort Bragg, North Carolina.

"By not repudiating them, President Trump has brought his earlier statements with him into the White House," the motion said.

Officials for Trump were not immediately available for comment.

U.S. military prosecutors charge that Bergdahl sneaked off his post, leading to a 45-day search that put soldiers' lives at risk and diverted attention from the fight against the Taliban.

Bergdahl, who is currently deployed at Fort Sam Houston, in San Antonio, Texas, was freed in a prisoner swap in May 2014 involving the release of five Taliban leaders held by the United States. The deal drew heavy criticism from Republicans.

The head of the Army team that investigated Bergdahl has said he does not believe the sergeant should face jail time.

Major General Kenneth Dahl, who led the military's investigation of Bergdahl's case, testified at a military probable cause hearing in 2015 that Bergdahl was not a Taliban sympathizer and that no soldiers directly involved in the search for him were killed. 

(Reporting by Jon Herskovitz; Editing by Jonathan Oatis)