Sgt. Bowe Bergdahl, who is accused of deserting his Army outpost and was taken prisoner by the Taliban for five years before being freed in exchange for five Taliban prisoners, has requested a pardon from President Obama.

A source told Fox News that, in a letter, Bergdahl both thanked the President for rescuing him in May 2014 in a controversial exchange for five Taliban prisoners from Guantanamo Bay and asked for a pardon.

Bergdahl’s legal team submitted copies of a clemency application to the White House, the Pentagon, and the Justice Department immediately after the election, the New York Times reported.

The pardon would avert Bergdahl’s court-martial trial, which is slated to begin April 18.

He is facing charges of desertion and misbehavior before the enemy that endangered fellow soldiers.

President-elect Donald Trump criticized Bergdahl on the campaign trail, calling him a “dirty, rotten traitor” who “should have been executed,” the Hill reported.

Trump has also criticized the policy of hostage trading, while promising to be tougher on terrorism than Obama.

Bergdahl’s lawyer, Eugene Fidell, said he will submit a motion to have the case dismissed if it has not been approved by Inauguration Day.

According to the Times, Fidell argued that it will be impossible for his client to receive a fair trial with Trump as president, citing the “beating” Trump gave Bergdahl on the campaign trail, and asked for the case to be dropped.