(CNN) Defense Secretary Mark Esper said he was "flabbergasted" to discover that then-Navy Secretary Richard Spencer had been working a White House back channel to resolve a standoff over controversial Navy SEAL Eddie Gallagher.

Esper said he and the chairman of the joint chiefs, Gen. Mark Milley, were told by someone at the White House that Spencer had approached the Oval Office with a proposal to resolve a standoff over Gallagher, who had faced possible expulsion from the SEALs until President Donald Trump intervened.

"We had no knowledge whatsoever" of Spencer's proposal to the White House, Esper told reporters at the Pentagon on Monday. "We were flabbergasted by it, and quite surprised and caught completely off guard."

Spencer told CBS Evening News in an interview that aired Monday, "I will take the bad on me for not letting (Esper) know I did that," but insisted that Esper "was completely informed as to this because his chief of staff was briefed on it." Pentagon spokeswoman Alyssa Farah told CNN in a statement Monday night "neither Secretary Esper nor anyone on his staff was aware" of Spencer's back-channel efforts.

Asked Monday about Spencer's forced resignation, Trump told reporters at the White House that it had been on his mind for some time. "We'd been thinking about that for a long time. That didn't just happen. And I have to protect my war fighters," he said.

An 'ultimate fighter'

Trump called Gallagher "one of our ultimate fighters."

"Somebody has their back, and it's called the President of the US, OK?" Trump said in the Oval Office, adding, "I think what I'm doing is sticking up for our armed forces."

That's a declaration many in the Pentagon have been disputing.

On November 15, Trump had reversed Gallagher's demotion and pardoned two other service members also accused of war crimes, deeply upsetting military leaders who had warned the President that such a move could undermine the forces' order and discipline, damage the integrity of the military justice system and erode the confidence of US allies and partners who host US troops.

Esper also said Monday that Trump had ordered him to allow Gallagher to keep his status as a SEAL, despite resistance from Navy leaders.

Esper said the President "gave me an order" to ensure that Gallagher would retain his Trident, the pin worn by Navy SEALS that symbolizes their membership in the elite military community. "He said, 'What about the pin? I want Eddie's' -- he wanted Eddie Gallagher's pin restored, and I said, 'Roger, I got it,' " Esper said, recounting the Sunday conversation with Trump.

"Gallagher will retain his Trident as the commander in chief directed and will retire at the end of this month," Esper added.

'Secret agreement'

Trump and Esper spoke a day after the defense secretary fired Spencer over the incident surrounding Gallagher, whose case has raised tensions between military leaders and the White House.

Gallagher had been convicted of bringing discredit to the armed services after posing next to a dead ISIS fighter's body, which is against regulations. He was demoted for that offense and acquitted of a separate murder charge.

Even as Trump had pushed for Gallagher to remain a SEAL, Navy officials had begun an administrative review that was expected to end with Gallagher's expulsion from the elite force, a position Spencer backed publicly.

Esper took pains to make clear that his decision to fire Spencer wasn't driven by the former Navy secretary's stance on Gallagher but was the result of Spencer's secret outreach to the White House.

"Contrary to the narrative that some want to put forward in the media, this dismissal is not about Eddie Gallagher, it's about Secretary Spencer and the chain of command," Esper said Monday.

But Esper's is just one of the competing narratives that emerged in the chaotic hours after Spencer's dismissal, muddying the waters of a case that could have serious implications for the broader military, analysts say.

Trump suggested on Twitter that Spencer's dismissal had to do with cost overruns and the way Gallagher had been treated by the Navy. Esper said he had asked Spencer to resign because he had lost "trust and confidence in him," according to a Pentagon spokesman. Spencer suggested he had resigned because he felt that obeying Trump's directive would require him to violate the "sacred oath" he had taken to uphold the Constitution.

"There have been at least three different versions of what happened," said John Kirby, a retired admiral who has served as both Pentagon and State Department spokesman.

Kirby noted that if Spencer were indeed "privately and behind Esper's back trying to arrange a fixed outcome" in Gallagher's case, it is "completely inappropriate for a service secretary to be trying to work an end run around the defense secretary in the halls of the White House."

"Part of the problem is that this administration doesn't have a reputation for honesty, and so we're still left to wonder exactly what the ticktock was here," Kirby said.

'Move beyond this'

On Monday, Esper essentially said Gallagher's case had become so fraught that any decision about it would come in for criticism. The defense secretary said he wanted the Navy to move on.

Speaking of senior naval officers, he said that despite their professionalism, no matter what they decided "they would be criticized from many sides, which would further drag this issue on, dividing the institution. I want the SEALs and the Navy to move beyond this now and get fully focused on their war-fighting mission."

After Trump intervened in Gallagher's case, Navy officials launched their formal review to determine if the SEAL was fit to serve. While the review is protocol after a conviction, it was expected to lead to Gallagher's expulsion. When Trump vowed on Twitter that he would never permit the Navy to revoke Gallagher's membership in the elite group, Spencer reportedly reached out behind the scenes.

He suggested to the White House that Gallagher's review go ahead but proposed a secret guarantee that Gallagher would be allowed to keep his status as a Navy SEAL, according to the senior defense official. In public, Spencer took a very different stand, saying he would push forward with a review regardless.

Rippling impact

Trump's intervention in the case will continue to have rippling impacts, Kirby said. "There are much larger cultural, legal and institutional equities that are now impacted by the President's decision to involve himself to this degree in the career outcome of one sailor."

Navy SEAL commander Collin Green has been trying for months to overhaul ethics and standards of conduct inside the Navy SEAL community, which he sees as badly in need of reform

"Now some of those efforts could be in jeopardy because of the intrusion of the commander in chief into what should have been" an administrative issue, Kirby said.

Kirby pointed out that Trump's decision to weigh in on Gallagher's case raises questions about how many more cases he will act to influence. The Army could feel the impact first, as it deals with the case of Maj. Mathew Golsteyn, one of the service members Trump pardoned for an alleged war crime.

The Army is now conducting an administrative review to determine whether Golsteyn should keep his Army Ranger tab -- the equivalent of the SEALs Trident pin.

"There's a standard to become an Army ranger, and you have to maintain a certain standard," Kirby said, describing Rangers as "a prestigious, elite" community.

"Now what's going to happen? ... At what level does the President stop interfering with normal administrative process. Where does it end?" Kirby said.

This issue isn't whether Trump, as commander in chief, can make these moves, Kirby said. "The question is should he."