President Trump’s attempt to manipulate military justice had a sorry outcome Sunday with the firing of Navy Secretary Richard V. Spencer. For the past nine months, Spencer had tried to dissuade Trump from dictating special treatment for Navy SEAL Edward Gallagher — but in the end Spencer was sacked for his efforts to protect his service.

​With Spencer’s firing, Trump has recklessly crossed a line he had generally observed before, which had exempted the military from his belligerent, government-by-tweet interference. But the Gallagher case illustrates how an irascible, vengeful commander in chief is ready to override traditional limits to aid political allies in foreign policy, law enforcement and now military matters.

Spencer was fired by Defense Secretary Mark T. Esper late Sunday, supposedly because Esper was “deeply troubled” that Spencer had tried to work out a private deal with the White House that would avoid a direct presidential order scuttling a scheduled SEAL peer-review process. That panel was set to determine whether Gallagher would keep his coveted Trident pin, marking him as a SEAL, after he was convicted in July for posing in a trophy photo with the corpse of a Islamic State captive.

Spencer had tried to find a compromise, sources tell me, after Trump tweeted Thursday, “The Navy will NOT be taking away Warfighter and Navy Seal Eddie Gallagher’s Trident Pin.” Spencer feared that a direct order from Trump to protect Gallagher, who is represented by two former partners of Trump’s personal attorney Rudolph W. Giuliani, would be seen as subverting military justice.

After that Trump tweet, Spencer cautioned acting White House Chief of Staff Mick Mulvaney that he would not overturn the planned SEAL peer review of Gallagher without a direct presidential order; he privately told associates that if such an order came, he might resign rather than carry it out. Gen. Mark A. Milley, the chairman of the Joint Chiefs of Staff, spoke with the White House late Thursday to try to avert this collision.

Milley’s de-escalation efforts initially appeared to be successful. A Pentagon official messaged me Friday morning: “Missiles back in their silos … for the time being.” But the truce was short-lived. By Saturday, the White House was demanding to know whether Spencer had threatened to resign; the Navy secretary issued a statement denying that he had made any such public threat and continued to seek a deal that would protect the Navy from a direct showdown with Trump.

“It was a hold-your-nose solution,” said a source close to Spencer about his effort to broker an arrangement that would allow Gallagher to retire at the end of November with his former rank, an honorable discharge and his Trident pin, as Trump wanted, but without direct presidential interference in the SEAL review process. As so often happens with attempts to work with Trump’s erratic demands, this one ended in disaster.

“The president wants you to go,” Esper told Spencer on Sunday, according to this source. Esper then toed the White House line and announced Spencer’s dismissal.

For Pentagon officials who have wondered whether Esper would have the backbone to resist Trump, Sunday’s events were troubling. The Pentagon, like the State Department under Mike Pompeo, is now overseen by an official whose overriding priority seems to be accommodating an impetuous boss in the White House.

Spencer’s letter Sunday to Trump, acknowledging his “termination,” echoed that of former defense secretary Jim Mattis, who resigned in December because of similar concerns about Trump’s unwise intervention in military and national-security decisions.

“As Secretary of the Navy, one of the most important responsibilities I have to our people is to maintain good order and discipline, throughout the ranks. I regard this as deadly serious business,” Spencer wrote. “The rule of law is what sets us apart from our adversaries.” In a paraphrase of what Mattis wrote 11 months ago, Spencer wrote that Trump should have a Navy secretary “who is aligned with his vision.”

For Navy commanders who have worried about eroding discipline in a SEAL force that’s lionized in movies and television, and protected by presidential diktat, Spencer’s most ominous line was: “I no longer share the same understanding with the commander in chief who appointed me, in regards to the key principle of good order and discipline.”

Trump began lobbying Spencer to exempt Gallagher from Navy discipline back in March, when he ordered the Navy secretary in an early-morning phone call to release Gallagher from the brig and give him more comfortable quarters. Presidential pressure has been relentless, ever since.

Gallagher has become a hero in the Trump echo chamber of Fox News commentary, where he’s seen as a victim of vengeful SEAL commanders. His case may have caught White House attention because his legal team included two Trump friends who are former partners of Giuliani: investigator Bernard Kerik, a former New York police commissioner, and Marc Mukasey, who represents Trump.

While Gallagher is celebrated on Fox, current and former senior officers of the SEALs and other elite units told me this weekend that his case has little support within the community of Special Operations forces. One former SEAL commander noted that maintaining discipline among these elite units is so important that the SEAL peer-review panels have removed more than 150 Trident pins since 2011, or more than one a month.

That’s the process of internal accountability that Spencer was trying to defend, and that Trump sabotaged

Watch the latest Opinions video:

Read more: