Washington: US Defense Secretary Mark Esper demanded the resignation of the Navy’s top civilian leader Sunday, an abrupt move aimed at ending an extraordinary dispute between President Donald Trump and his own senior military leadership over the fate of a SEAL commando in a war crimes case.

In a statement, Esper said he had lost trust in the Navy secretary, Richard V. Spencer, because his private statements about the case differed from what he advocated in public. Esper added that he was “deeply troubled by this conduct.”

A senior Defence Department official and a senior White House official said Sunday night that Spencer was trying to cut a side deal with the White House to let the commando remain in the elite unit, even as he pushed both publicly and with Pentagon officials for a disciplinary hearing.

But Spencer had also provoked Trump’s ire by threatening to resign over the case and by publicly saying he disagreed with the president’s decision to intervene in favour of the commando, Chief Petty Officer Edward Gallagher, Defense Department officials said.

Spencer’s friends cited those reasons for his departure, saying that Esper was mischaracterising the situation.

Spencer’s resignation letter, dated Sunday, said he regarded good order and discipline throughout the Navy’s ranks to be “deadly serious business.”

“The lives of our sailors, Marines and civilian teammates quite literally depend on the professional execution of our many missions, and they also depend on the ongoing faith and support of the people we serve and the allies we serve alongside,” the letter said.

He added: “Unfortunately, it has become apparent that in this respect, 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. I cannot in good conscience obey an order that I believe violates the sacred oath I took.”

A Defence Department official said Gallagher would now keep his Trident pin, the symbol of his membership in the SEALs, at Esper’s direction because of concerns that the events of the last few days would make it impossible for him to get an impartial hearing.

Trump railed against the handling of the case Sunday, saying on Twitter that Gallagher had been “treated very badly.” He also announced that he would nominate Kenneth Braithwaite, the ambassador to Norway, to replace Spencer, an investment banker and retired Marine aviator who had held the job since 2017.

Sen. Chuck Schumer of New York, the Democratic leader, called Spencer “a patriot” in a statement Sunday evening.

“Secretary Spencer did the right thing and he should be proud of standing up to President Trump when he was wrong, something too many in this administration and the Republican Party are scared to do,” Schumer said. “Good order, discipline and morale among the armed services must transcend politics, and Secretary Spencer’s commitment to these principles will not be forgotten.”

The ousting of Spencer, first reported by The Washington Post, is the latest turn in an extraordinary story in which Trump has angered and alienated military leaders by intervening in the cases of three US service members who had been accused of war crimes.

The president and the Defence Department leadership have been at odds since Nov. 15, when Trump, over objections from the Pentagon, reversed the demotion of Gallagher and pardoned two other service members, overruling military leaders who sought to punish them. All three were lionised by conservative commentators who portrayed them as war heroes unfairly prosecuted for actions taken in the heat of battle.

Gallagher was turned in by his own platoon last spring. Several fellow SEALs reported that he had shot civilians and killed a captive Islamic State fighter with a custom hunting knife during a deployment in Iraq in 2017. He was also charged with obstruction of justice for threatening to kill SEALs who reported him.

At trial he was acquitted of all charges except one, for which he was demoted: bringing discredit to the armed forces by posing for photos with the teenage captive’s dead body.

Trump reversed that demotion, and also announced that he was ordering the pardons of Clint Lorance, a former Army lieutenant who was serving a 19-year sentence for the murder of two civilians, and Maj. Mathew L. Golsteyn, an Army Special Forces officer who was facing murder charges for killing an unarmed Afghan he believed was a Taliban bomb-maker.

While the Army carried out the president’s orders and dropped the matter, the Navy did so but also began disciplinary proceedings to strip Gallagher of his Trident pin and oust him from the elite SEAL commando unit.

Trump was having none of it. On Thursday, he wrote on Twitter that “the Navy will NOT be taking away Warfighter and Navy SEAL Eddie Gallagher’s Trident Pin.”

He added: “This case was handled very badly from the beginning. Get back to business!”

The president’s tweet further infuriated top Navy and SEALs leaders, and Spencer threatened to resign, Defence Department officials said. He told a number of Pentagon officials that he was willing to go to the mat over this, and it was under that belief that Esper and Gen. Mark A Milley, the chairman of the Joint Chiefs of Staff, then went to Trump to ask him to allow the disciplinary process to go through.

A senior Defence Department official said Spencer was also pursuing the side deal with the White House, unbeknown to either Esper or Milley. Spencer, the official said, told White House officials that if Trump allowed the disciplinary process to go forward, Spencer would see to it that Gallagher was not ousted from the Navy SEALs in the end.

After arguing Spencer’s public case to Trump, Esper was furious to discover that the Navy secretary had tried to make a side deal with the White House without informing him, the official said.

“Bananas, completely bananas,” Gallagher’s lawyer, Timothy Parlatore, said when asked about the resignation Sunday. “Whoever cooked up this drug deal, they didn’t let me in on it. But if the secretary of the Navy did lie to the secretary of defence, he had no choice but to ask him to resign.”

A Navy Special Warfare official in San Diego said SEAL commanders were caught off guard by the announcement and were “floored,” saying if there was a back-channel deal between the secretary of the Navy and the White House, the SEAL commander, Rear Adm Collin Green, and his staff were not aware of it.

The official said the SEALs and the secretary of the Navy’s staff had been in constant contact throughout the decision to submit Gallagher to a Trident review board, and had briefed the decision to the acting White House chief of staff, Mick Mulvaney, and gotten no pushback.

As of Friday, Navy Special Warfare had been told it was cleared to proceed, the official said.