Ousted Secretary of the Navy Richard Spencer fired back at President Trump as the administration official left his office for the last time.

Defense Secretary Mark Esper dismissed Spencer after learning he attempted to go around Esper to strike a secret deal with the White House that would have allowed Navy SEAL Eddie Gallagher to retire with his SEAL Trident insignia if Trump refrained from getting involved in the branch's review of his war crimes case. Esper requested Spencer’s resignation on Sunday after losing confidence in him.

Gallagher, who was cleared of murder charges, was demoted one rank after he was found guilty of photographing the corpse of an ISIS fighter he was accused of killing. The Navy was also considering further disciplining the SEAL, including expelling him from the elite unit. Trump, however, restored his rank earlier this month and publicly ordered that the Navy let Gallagher retire with his rank and Trident.

"What message does that send to the troops? That you can get away with things. We have to have good order and discipline. It's the backbone of what we do," Spencer said, firing parting shots at Trump in a Monday interview with CBS.

"I don't think he really understands the full definition of a war fighter," he continued, responding to Trump's defense of Gallagher in a press conference earlier that day. "A war fighter is a profession of arms, and a profession of arms has standards that they have to be held to and they hold themselves to."

Spencer took responsibility for going behind Esper's back but also said he had informed Esper's staff of what he was doing.

"I will take the bad on me for not letting him know I [tried to strike a deal with the White House], but [Esper] was completely informed to this because his chief of staff was briefed on it," Spencer said.

Trump has nominated U.S. Ambassador to Norway Kenneth Braithwaite to replace Spencer as the next secretary of the Navy.