WASHINGTON — A former prisoner of war accused of endangering his U.S. comrades by walking off his post in Afghanistan is asking President Barack Obama to pardon him before leaving office.

Pfc. Bowe Bergdahl went missing from his post in Afghanistan on June 30, 2009. U.S. Army via AFP - Getty Images file

White House and Justice Department officials say U.S. Army Sgt. Bowe Bergdahl submitted the clemency request. If granted, it would allow Bergdahl to avert a court-martial trial scheduled for April. He faces charges carrying a maximum penalty of life in prison.

Bergdahl walked off his post in Afghanistan in 2009 and was held captive by the Taliban and its allies for five years. The Obama administration's decision to swap prisoners for his return in 2014 was criticized by some Republicans.

During the campaign, President-elect Donald Trump described Bergdahl as a "no-good traitor, who should have been executed."