Sen. John McCain, chairman of the Senate Armed Services Committee, is shown in a February photo. (Saul Loeb/AFP/Getty Images)

Sen. John McCain’s declaration last year that he would hold a hearing about the controversial case of Sgt. Bowe Bergdahl if the Army doesn’t punish him has prompted the soldier’s lawyers to call for the dismissal of his entire case, citing newly released emails by the government.

The motion, filed this week in an Army court at Fort Bragg, N.C., states that the service must dismiss both charges that Bergdahl faces in connection with walking away from his patrol base in eastern Afghanistan in June 2009 and getting captured by the Taliban. Bergdahl, now 30, was subsequently held captive over the border in Pakistan until President Obama approved a deal in May 2014 in which five Taliban detainees held at Guantanamo Bay were transferred to supervised release in Qatar.

McCain, a vociferous critic of the “five-for-one” trade, told reporters in New Hampshire in October 2015 that Bergdahl was “clearly a deserter” and had at the minimum put the lives of other soldiers who were searching for him in danger. That, combined with the call for a hearing, means the Army must dismiss the case “because any other action would leave a cloud over the independence of the proceeding and deny Bergdahl due process of law,” according to the motion.

A spokesman for McCain, Dustin Walker, declined to comment about the motion, citing the open nature of Bergdahl’s case.

The motion includes messages between Army officials and Senate Armed Services Committee staff members that show they were concerned about the effects of McCain’s comments and interest in the case.

In one example, the committee’s general counsel — identified elsewhere as Steve Barney — asked Army officials in a May 2015 email what the service’s views were “on the implications of conducting a hearing during an ongoing investigation that would help me inform the chairman of his options.” The Army had decided two months before that Bergdahl would face charges of desertion and misbehavior before the enemy, the latter of which can carry up to a life sentence.

Army Sgt. Bowe Bergdahl, right, arrives for a pretrial hearing at Fort Bragg, N.C., with his defense counsel, Lt. Col. Franklin D. Rosenblatt, on Jan. 12. Bergdahl, who was held by the Taliban for five years after he walked off a base in Afghanistan, faces charges of desertion and misbehavior before the enemy. (Ted Richardson/AP)

An Army official responded two days later, warning that the service “has taken great care to avoid any actual impropriety or appearance of impropriety” in the case. Any hearing before the case was completed would “raise significant legal issues and may undermine our judicial process.” A major concern: unlawful command influence, in which a person with influence over a legal situation makes statements or carries out actions that can sway a court case.

Army officials held a preliminary hearing for the case in September, just ahead of McCain’s comments in New Hampshire on Oct. 11, 2015. The senator said that “if it comes out” that Bergdahl receives no punishment, McCain’s committee would “need to have a hearing on that.”

Behind the scenes, the Army emailed the Senate Armed Services Committee’s general counsel the following day, according to email traffic obtained by Bergdahl’s lawyer and released this week.

“Need some assistance,” the message said. “As you are likely aware, Chairman McCain has publicly announced that he will ‘hold a hearing’ if Sgt. Bergdahl does not go to jail. As we both know, UCI [unlawful command influence] technically requires a commander to make a comment. However, in this case, coming from the chairman of the oversight committee has raised some serious concerns across the Army.”

The Army official added that “obviously, the chairman’s statement is out there,” but asked for the release of a “curative statement” to ease concerns about McCain’s remarks. The official offered to assist the committee in crafting language to do so, but was not taken up on his offer.

Bergdahl’s new motion states that neither the Army nor anyone on McCain’s staff “walked the cat back” on McCain’s comments.

“One can only assume that the power dynamic between the Army and Sen. McCain was such that it was politically unthinkable to embarrass him in public by issuing such a corrective without his consent,” the motion said. “The result was that the Army maintained the peace with its impetuous Senate overseer and Sgt. Bergdahl’s due process rights were disregarded.”

Bergdahl is expected to face court-martial at Fort Bragg in February next year.

More coverage: 

U.S. soldier held captive released in exchange for Afghan detainees: June 1, 2014

Mixed reaction to Bowe Bergdahl’s recovery among those who consider him a traitor: June 1, 2014

War-zone deserter? If so, Bowe Bergdahl joins a fascinating and bizarre club: June 4, 2014

Afghan villagers recall when Bergdahl stumbled into their midst: June 4, 2014

Bergdahl’s writings reveal a fragile young man; June 11, 2014

Guantanamo transfer for Bowe Bergdahl violated federal law: Aug. 21, 2014

Bowe Bergdahl, once-missing U.S. soldier, charged with desertion; March 25, 2015

Bowe Bergdahl, in sparse prose, details his captivity for the first time; March 25, 2015

Disillusioned and self-deluded, Bowe Bergdahl vanished into a brutal captivity; Sept. 20, 2015

Army officer recommends against prison time for Bowe Bergdahl, lawyer says; Oct. 10, 2015

Donald Trump vs. Bowe Bergdahl: Soldier’s lawyer says political attacks have gone too far; Nov. 22, 2015

Lawmakers accuse White House of concealment in Bowe Bergdahl prisoner swap; Dec. 9, 2015

Army tables decision on Bowe Bergdahl’s POW Medal and Purple Heart until after court-martial; Jan. 15, 2016

Bowe Bergdahl’s mental disorder identified in new ‘Serial’ podcast episode; Feb. 19, 2016

‘It was too late to return.’ New glimpse into Bowe Bergdahl desertion case emerges in documents; March 17, 2016