Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A military judge in North Carolina has agreed to suppress statements made in captivity by former prisoner of war Bowe Bergdahl, the Army sergeant who wandered away from his base in Afghanistan in 2009 and was captured by the Taliban.

Bergdahl, 31, is facing a court martial. He appeared at a court in Fort Bragg, North Carolina, on Tuesday for a motion hearing.

Army Judge Col. Jeffery R. Nance suppressed statements made by Bergdahl while he was held captive, NBC affiliate WRAL of Raleigh reported. His defense attorneys argued that the statements made in captivity are highly unreliable and were coerced.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Bergdahl was rescued and returned to the United States via a prisoner swap in 2014 in exchange for five prisoners held at Guantanamo Bay. The swap was mediated by the government of Qatar.

Some Republicans criticized the deal and President Donald Trump as a candidate called Bergdahl a "traitor" who should be harshly punished — comments that Nance in February called "disturbing."

Nance later denied a motion to dismiss the charges over the president's comments, according to court documents.

Nance also ruled on Tuesday to allow the testimony from two people who were injured while searching for Bergdahl, WRAL reported.

Related: Bergdahl Explains His Reasoning in Newly Released Documents

A trial is scheduled for Oct. 23, according to the Army. The voir dire process for potential military panel members is scheduled to begin on Oct. 16.

Bergdahl was charged in March of 2015 with desertion and misbehavior before the enemy — charges that carry a potential life sentence.