U.S. Navy Secretary Richard V. Spencer was forced out over the weekend after losing a power struggle with Fox News host Pete Hegseth over the fate of Eddie Gallagher, a Navy SEAL who had been accused of war crimes during a 2017 deployment to Iraq.

Gallagher’s case has reportedly triggered a schism between President Donald Trump and top Pentagon officials. The SEAL was acquitted in July on charges related to the murder of a teenage prisoner of war, but he was demoted after being convicted of posing for photos with the body. Trump cleared Gallagher on November 15 and restored his rank, overruling the Defense Department. Navy officials subsequently sought to convene a review board to remove Gallagher from his elite unit and strip him of his Trident pin -- a symbol of his SEALs membership. The process reportedly continued even after Trump tweeted his disapproval of the move.

On Sunday afternoon, that clash triggered Spencer’s removal after Defense Secretary Mark Esper asked for his resignation. As is often the case with high-profile Trump administration personnel changes, there are differing accounts and open questions about what actually happened. Esper has claimed that he sought Spencer’s resignation after learning that Spencer had proposed a side deal to the White House in which he would ensure Gallagher be allowed to keep his Trident and retire if the White House would allow the review board to proceed unimpeded. But, according to The New York Times, sources close to Spencer reportedly deny this, arguing that he had angered the president “by threatening to resign over the case and by publicly saying he disagreed with the president’s decision to intervene.”

What seems clear, however, is that the case shows the influence of the Fox-Trump feedback loop and, in particular, the sway Hegseth has over the president. The conflict that led to Spencer’s termination is a direct result of the president of the United States watching Hegseth on television and taking his advice.

Like several of his Fox colleagues, Hegseth has parlayed loyal sycophancy on one of the president’s favorite television programs into a side gig as an unofficial presidential adviser. In recent months, he has used that influence to aggressively lobby for Trump to intercede in the cases of Gallagher and other alleged or convicted war criminals. (Trump has repeatedly provided executive clemency for people who have received positive coverage on Fox.)

Hegseth devoted numerous Fox & Friends segments to their causes, repeatedly hosted their family members and lawyers to ask the president for pardons, and privately urged the president to do so. An Iraq and Afghanistan combat veteran, Hegseth has said that he also would be convicted of war crimes by the standards applied in those cases. His segments caught Trump’s attention (the president repeatedly live-tweeted segments about the war crimes cases), and his argument ultimately overwhelmed that of the Pentagon.

Spencer and the Navy came under fire from Hegseth during five separate segments over the course of Sunday morning’s Fox & Friends broadcast, just hours before his removal. The segments, running at the top of each hour of the program, highlighted reports that Spencer had threatened to resign over Trump’s interference in the case and the ongoing review into whether Gallagher should be removed from the SEALs.

Hegseth lashed out at Spencer for not stopping the Gallagher review in light of Trump’s tweet that he not be stripped of his Trident pin. “You look at this from the beginning, the president’s tweet was clear: Don’t take away this guy’s Trident,” Hegseth said. “It looks like, because it is, retribution for the fact that the president weighed in.” “The president made his commander’s intent very clear. The Navy has decided to create a conflict,” Hegseth added during a second segment.

Trump was apparently watching at least one of those segments, since he tweeted about the forthcoming 7:30 a.m. interview with Gallagher mentioned during each of them.

During that interview, Hegseth repeatedly gave Gallagher the opportunity to speak directly to the president about what he wanted to happen with his case.