Richard Spencer, who was fired as secretary of the Navy for resisting President Donald Trump's advocacy of a Navy SEAL who was acquitted of murder, said Wednesday that he had personally asked the president to stay out of the case but was rebuffed because the president doesn't understand the military.

In an op-ed column in The Washington Post, Spencer wrote that from the start, Trump personally involved himself in the case of Chief Petty Officer Eddie Gallagher, who was convicted in July of posing with the corpse of a young Islamic State fighter but was acquitted of having killed the young man.

Gallagher was demoted from chief petty officer to petty officer first class and fined two months' wages.

Spencer wrote that as early as four months before the trial, Trump called him twice asking that Gallagher not be confined in a Navy brig; eventually, the president ordered him to have Gallagher transferred.

Earlier this month, after Gallagher submitted his request to retire, the Navy began the process to assess which rank he would be allowed to hold at retirement and whether he would be allowed to keep the gold Trident insignia signifying his status as a member of the elite Sea, Air, and Land Teams, or SEALs.

Spencer wrote that on Nov. 14, he sent Trump a note asking him not to get involved in the questions but that White House Counsel Pat Cipollone called the next day to say the president would remain involved.

"Shortly thereafter, I received a second call from Cipollone who said the president would order me to restore Gallagher to the rank of chief," he wrote.

"This was a shocking and unprecedented intervention in a low-level review," he wrote. "It was also a reminder that the president has very little understanding of what it means to be in the military, to fight ethically or to be governed by a uniform set of rules and practices."

Last week, Trump tweeted that Gallagher would be allowed to keep his Trident pin, Spencer wrote, but "I did not believe it to be an official order, chiefly because every action taken by the president in the case so far had either been a verbal or written command."

Multiple sources told NBC News last week that Spencer privately told the White House that a tweet wasn't an official order and that if Trump was ordering the Navy to end the review proceedings, he needed to do so in writing.

The Defense Department said Sunday that — contrary to what he was saying in public — Spencer also privately proposed to the White House both that Gallagher's rank be restored and that he be allowed to retire as a SEAL. It said Defense Secretary Mark Esper was never informed of the private proposal.

In his column on Wednesday, Spencer confirmed that he went behind Esper's back — the reason the Defense Department gave for firing him.

"That was, I see in retrospect, a mistake for which I am solely responsible," he wrote.

Spencer wrote that he believed that Trump was swayed by Gallagher's attorneys and others who advocated for him publicly.

Gallagher, himself, went public at times in an unorthodox campaign of an active-duty service member publicly challenging the authority of his commanding officers.

In an interview on Fox News Channel's "Fox & Friends" on Sunday, Gallagher accused the Navy of seeking to strip the SEAL designation as retribution for Trump's intervention on his behalf.

"This is all about retaliation. They could have taken my Trident at any time they wanted," he said. "Now they're trying to take it after the president restored my rank."

Referring to Rear Adm. Collin P. Green, who as commander of Naval Special Warfare Command is in charge of the SEALs, Gallagher alleged: "What the admiral is doing is showing complete insubordination."

Acting Navy Secretary Thomas Modly on Wednesday said that the review boards for Gallagher and three other SEALs involved in the case would be dropped and earlier in the week said Gallagher would be allowed to retire as chief petty officer with his Trident pin.