Updated

Former U.S. Army Sgt. Robert "Bowe" Bergdahl, who was court-martialed in 2017 after being accused of abandoning his post in Afghanistan and endangering fellow service members, has filed a civil lawsuit in a bid to overturn his conviction.

The court filing names the United States as the defendant. It seeks to determine whether the U.S. military "erred in failing to remedy unlawful command influence" by former President Donald Trump and the late U.S. Sen. John McCain, R-Ariz., and whether a military judge in Bergdahl’s case had failed to disclose he had applied for a high-paying job with the U.S. Justice Department.

The lawsuit, submitted Wednesday in the U.S. District Court for the District of Columbia, also refers to Trump’s alleged actions in the Bergdahl case as "scandalous meddling."

SUPREME COURT ENDS TRUMP EMOLUMENTS LAWSUITS

Last August, the U.S. military’s top appeals court upheld Bergdahl’s conviction, rejecting arguments that public comments by Trump and McCain should have invalidated his prosecution, Military.com reported.

Former U.S. Army Sgt. Robert "Bowe" Bergdahl.

Former U.S. Army Sgt. Robert "Bowe" Bergdahl.

Bergdahl made his arguments against Trump and McCain despite having pleaded guilty to charges of desertion and misbehavior that resulted in his dishonorable discharge and other punishments in November 2017.

Prior to becoming president in January 2017, Trump had publicly referred to Bergdahl as "a dirty, rotten traitor," and later made reference to his past remarks after becoming president, the report said.

REP. BENNIE THOMPSON FILES CIVIL LAWSUIT AGAINST TRUMP FOR JAN. 6 RIOT: 'WE MUST HOLD HIM ACCOUNTABLE'

McCain vowed to call for a hearing in the Senate Armed Services Committee if Bergdahl wasn’t punished for the allegations he faced, the report added.

McCain died of cancer in August 2018 at age 81.

Comments attributed to former President Donald Trump, left, and the late Sen. John McCain, R-Ariz., are at issue in Bowe Bergdahl's new civil lawsuit.

Comments attributed to former President Donald Trump, left, and the late Sen. John McCain, R-Ariz., are at issue in Bowe Bergdahl's new civil lawsuit.

But Judge Kevin Ohlson ruled "it was the strength of the Government’s evidence," not the comments of Trump and McCain, that prompted Bergdahl to plead guilty, the judge said, according to the report.

Ohlson noted that at his sentencing hearing, Bergdahl had requested a dishonorable discharge.

CLICK HERE TO GET THE FOX NEWS APP

After abandoning his post in June 2009, Bergdahl was captured by the Taliban and held prisoner for nearly five years until he was returned to the U.S. in exchange for five Taliban detainees who were being held at the U.S. detention facility at Guantanamo Bay, Cuba.

Bergdahl was welcomed at the White House upon his return but public sentiment turned against him as more details emerged about his actions in Afghanistan, Military.com reported.