Richard Spencer did not go quietly after Defense Secretary Mark Esper asked for his resignation as secretary of the Navy over his handling of the case of SEAL Eddie Gallagher, whose demotion for taking a photo with a corpse had been reversed by President Donald Trump. 

In the letter he submitted on his way out the door, he did not say that he resigned but rather stated, "I hereby acknowledge my termination." 

The letter delivered a scathing rebuke of Trump, who he said did not agree with him on the importance of military justice and discipline. He also said he had been given an order that he could not in "good conscience obey." 

The Navy had planned a review that could have led to Gallagher's expulsion from the elite SEAL commando group, but Trump said in a tweet that Gallagher should remain a SEAL. A day after denying news reports that he had threatened to resign over Trump's intervention, Spencer was out. 

Though Spencer's letter indicated he was fired because of the Gallagher affair, Esper accused Spencer of going behind his back to talk with the White House about how to resolve the case. Trump said he was fired because he did not like how Gallagher had been treated and because of "cost overruns," which he blamed on the Obama administration. 

Here is the full text of Spencer's letter

Dear Mr. President:

It has been the extreme honor of a lifetime to stand alongside the men and women of the Navy and Marine Corps team in the protection of the American people and the values we all hold dear.

Together we have made great strides over the past two years. strengthening the foundation of our readiness, and bolstering our constellation of allies and partners, to respond wherever needed with the honor and professionalism that have marked our force for the past 244 years.

Now more than ever, the United States Navy and Marine Corps stands ready and firm in every part of the globe, fueled at all times by our greatest resource - the men and women who wear the uniform. Many of them will soon miss their Thanksgiving dinners at home so that they can continue the watch beyond the curve of the horizon. They and their families are, and will forever be, my personal heroes.

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. The lives of our Sailors, Marines and civilian teammates quite literally depend on the professional execution 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 rule of law is what sets us apart from our adversaries. Good order and discipline is what has enabled our victory against foreign tyranny time and again, from Captain Lawrence's famous order "Don't Give up the Ship" to the discipline and determination that propelled our flag to the highest point of Iwo Jima.

The Constitution, and the Uniform Code of Military Justice, are the shields that set us apart, and the beacons that protect us all. Through my Title Ten Authority, I have strived to ensure our proceedings are fair, transparent and consistent, from the newest recruit to the Flag and General Officer level.

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 in the presence of my family, my flag and my faith to support and defend the Constitution of the United States.

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 United States Secretary of the Navy, to be effective immediately.

I will forever be grateful for every opportunity to have served, from my days as a Marine, to the extreme honor of serving as the 76th Secretary of the Navy. My wife Polly and I stand in appreciation and admiration of the patriots who today forge the next link in the unbroken chain of our Navy and Marine Corps, and we urge all Americans to keep them, and their families, in their hearts and prayers through this holiday season and beyond.

Thank you once again for the opportunity to serve.

Respectfully yours,

Richard V. Spencer