Defense Secretary Mark Esper forced Navy Secretary Richard Spencer to resign Sunday, saying he was “deeply troubled” over his handling of the case of a Navy SEAL accused of war crimes in Iraq, the Pentagon said.

Pentagon spokesman Jonathan Hoffman said Spencer submitted his resignation at Esper’s request, the Associated Press reported. In a letter to President Trump, Spencer said he “cannot in good conscience” obey an order he believes “violates the sacred oath” he took.

“The President deserves and should expect a Secretary of the Navy who is aligned with his vision for the future of our force generation and sustainment. Therefore, with pride, in the achievements we’ve shared, and everlasting faith in the continued service and fidelity of the finest Sailors, Marines, and civilian teammates on earth, I hereby acknowledge my termination as the United States Secretary of the military, effective immediately,” Spencer wrote in the letter.

Trump announced Sunday evening on Twitter that he will nominate the U.S. ambassador to Norway, Adm. Ken Braithwaite, to be the new secretary of the Navy. “A man of great achievement and success, I know Ken will do an outstanding job!” Trump said.

The Navy SEAL, Chief Petty Officer Edward Gallagher, was found guilty of posing with a corpse in Iraq in 2017 but acquitted of murder charges in the stabbing death of an Islamic State captive.

Gallagher released a statement to Fox News Sunday evening thanking those involved with his journey, and specifically acknowledged Trump. “You stepped in numerous times and showed true moral fiber by correcting all the wrongs that were being done to me. You are a true leader and exactly what the military and this nation needs,” he said in the statement.

In an interview published Monday in The Washington Post, Gen. Mark Milley, chairman of the Joint Chiefs of Staff, said the discussion over whether Gallagher would lose his SEAL Trident pin was now “case closed.”

The Washington Post reported Sunday that Esper asked for Spencer’s resignation after learning that Spencer privately told White House officials that if they did not interfere with proceedings against Gallagher, then Spencer would ensure that Gallagher was able to retire as a Navy SEAL, with his Trident pin.

That contradicted Spencer’s public statements. He said Saturday that it would take more than a presidential tweet to stop a disciplinary review of Gallagher, according to the Associated Press.

Esper and Milley learned of Spencer’s private offer to the White House when they spoke with Trump on Friday, Hoffman told the Post.

In a statement to the Post, Esper said he was “deeply troubled by this conduct.”

“Unfortunately, as a result I have determined that Secretary Spencer no longer has my confidence to continue in his position,” Esper said. “I wish Richard well.”

Trump said he was “not happy” with the way Gallagher’s case was handled in a tweet Sunday evening and added that “large cost overruns from past administration’s contracting procedures were not addressed to my satisfaction,” leading to Spencer’s termination. He again insisted that Gallagher will “retire peacefully with all of the honors that he has earned, including his Trident Pin.”

Earlier Sunday, the Navy was notified that the White House would not intervene to stop the disciplinary action against Gallagher, despite Trump’s assurances that he would on Twitter.

Trump said in a tweet Thursday that he would personally intervene if the Navy took away the Gallagher’s Trident pin.