Navy SEAL Eddie Gallagher’s long fight with the Navy is finally over, with the firing of Navy Secretary Richard Spencer and an order from President Donald Trump.

On Sunday, the Pentagon announced that Defense Secretary Mark Esper had fired Spencer, who had backed a review board into whether Gallagher would remain a Navy SEAL.

The Pentagon also announced that Gallagher would retain his Trident pin and retire as a Navy SEAL, ending months of uncertainty for the chief petty officer and his family.

Gallagher was accused by the Navy of murdering an Islamic State in Iraq and Syria fighter during a deployment to Iraq in 2017 against the Islamic State in Iraq and Syria.

After his unit came home, junior SEALs in his platoon accused him of killing a severely wounded ISIS fighter by plunging a knife into his neck and shooting at unarmed civilians. Gallagher had sent a photo to a friend of him holding a knife next to the dead ISIS fighter, but denied that he killed him.

Gallagher’s wife Andrea told Breitbart News in June that said some of the SEALs had been aggrieved since Gallagher had called them “pussies” and “cowards” during the deployment.

She said they started a private chat group that first complained of Gallagher stealing cookie butter and not paying for a haircut, but that after they learned he would become an instructor once again of them, they escalated their complaints to war crimes in early 2018.

In fall 2018, Gallagher was arrested and interrogated while Navy criminal investigators searched his home, forcing hischildren out of the home on a Saturday morning in their underwear and interrogating his wife. Gallagher was then held in pre-trial confinement at a brig in San Diego and charged with murder and other war crimes.

Gallagher’s defense team would find video evidence that showed Gallagher had treated the wounded ISIS fighter before he died — despite a whisper campaign that suggested there was video evidence of Gallagher killing the ISIS fighter.

They also found evidence that Navy criminal investigators had coerced witnesses into giving testimony, and other prosecutorial misconduct. Defense attorneys discovered that Navy prosecutors had used tracking software on the defense team and reporters, leading to the dismissal of the lead Navy prosecutor just weeks before the case went to court.

In July, Gallagher was acquitted by a military court jury after another member of his platoon — Navy prosecutors’ star witness — stepped forward and admitted he killed the ISIS fighter, not Gallagher, in a surprise revelation.

Gallagher was found guilty of one charge related to taking a photo with the deceased ISIS fighter and sentenced to four months in jail and a fine. Since Gallagher had been detained for nine months, he did not have to serve any additional time. The Navy ordered a review of its Judge Advocate Corps.

However — Gallagher’s fight was not over.

In October, the Navy decided to reduce his rank from chief petty officer to first class petty officer, which would result in a reduction of about $200,000 in retirement pay. Gallagher’s family argued that Gallagher had been punished enough, having already lost a promotion to senior chief petty officer, a Silver Star nomination, and a coveted instructor spot for a twilight tour before retirement.

Trump intervened on November 15 to restore Gallagher’s rank to chief petty officer. However, five days later on November 20, Rear Adm. Collin Green, commander of the Navy SEALs, moved to convene a review board into whether to kick Gallagher out of the Navy SEALs, in addition to three SEALs who supervised Gallagher.

Green had reportedly been considering the move for more than a year, but was concerned that if Gallagher was stripped of his Navy SEAL status, it would prejudice the jurors in his case, so he waited. He held off after Gallagher was acquitted in July out of concern it would look like retaliation, but after Trump restored Gallagher’s rank, Green decided to go ahead.

Trump reacted swiftly, tweeting the next day on November 21: “The Navy will NOT be taking away Warfighter and Navy Seal Eddie Gallagher’s Trident Pin. This case was handled very badly from the beginning. Get back to business!”

The Navy will NOT be taking away Warfighter and Navy Seal Eddie Gallagher’s Trident Pin. This case was handled very badly from the beginning. Get back to business! — Donald J. Trump (@realDonaldTrump) November 21, 2019

After Trump’s tweet, Spencer, who was at the Halifax Security Forum, said he backed the review going forward, and that he would await a formal order from Trump to act.

According to the Pentagon, after Esper returned from a trip to Asia on Friday, he learned from a senior White House official that despite Spencer’s public stance, the review should go forward. He had proposed to the White House that the review go forward but ultimately allow Gallagher to remain a Navy SEAL.

Esper on Monday told Pentagon reporters that he called Spencer immediately afterward, and Spencer was “forthcoming.” Esper said he told the president that he lost confidence in Spencer and would ask him to resign, and the president supported his decision. Esper then called Spencer on Sunday, asking for his resignation.

Esper said he then called the president, who directed that Gallagher remain a Navy SEAL.

Trump first intervened earlier this year to call for Gallagher’s release from a brig in San Diego where he had been kept under pre-trial confinement and unable to prepare for his defense.

Gallagher’s brother Sean said that he first got Rep. Ralph Norman (R-SC) and Duncan Hunter (R-CA) to take up his brother’s fight for exoneration, getting other members of Congress on board.

By luck, Gallagher’s uncle’s wife’s brother had a connection to Bernie Kerik, the former New York City police commissioner, who reached out to the Gallagher family to help. Kerik then brought his lawyer, Navy veteran Tim Parlatore, onboard.

Sean said Trump became interested in the case after hearing about it on Fox News. “All I had to do was get on TV and I spoke directly to him. That’s transparency, right?” he told Breitbart News in June.

Follow Breitbart News’ @Kristina_Wong.