(Reuters) - The legal team for U.S. Army Sergeant Bowe Bergdahl on Monday asked to have the charges against the former prisoner of war dismissed, arguing comments made by Senate Armed Services Committee Chairman John McCain violated his due process rights.

Slideshow ( 3 images )

Bergdahl, 30, is facing a court-martial with a potential life sentence on charges of desertion and endangerment of U.S. troops after he walked away from his post in Afghanistan in 2009 and became a Taliban prisoner for five years.

Defense attorneys argued in a motion filed on Monday that comments made by McCain and the committee’s general counsel, Steve Barney, have unduly influenced his case. The filing quotes McCain as saying last October: “If it comes out that (Bergdahl has no punishment, we’re going to have a hearing in the Senate Armed Services Committee.”

“I am not prejudging, OK, but it is well known that in the searches for Bergdahl, after - we know now - he deserted, there are allegations that some American soldiers were killed or wounded, or at the very least put their lives in danger, searching for what is clearly a deserter,” McCain added.

The statements, among others, defense attorneys argued, undermine the independence of the military proceeding and violate Bergdahl’s rights to due process. The motion said if the charges are not dropped and Bergdahl is convicted, he should at least face no punishment.

“It is not rocket science to see what was wrong with Sen. McCain’s comment,” the motion says. “His comments - as the Army certainly knows - constituted impermissible meddling in a pending criminal case and an abuse of his authority as chairman of a powerful Senate committee.”

Representatives for McCain’s office could not be immediately reached for comment, nor could a spokesman for the Senate Armed Services Committee.

U.S. military prosecutors have said Bergdahl sneaked off his post, resulting in a 45-day search that put soldiers’ lives at risk and diverted attention from the fight against the Taliban.

Bergdahl 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 court-martial is scheduled to begin on Feb. 6, 2017.