What happens when the president gives illegal orders to the military?

A commenter asked this question yesterday, and since this wasn’t covered in law school I asked someone who is very familiar with the military justice system. They told me the following:
I’ve not seen this in action, but these are the basic rules, and then ill give you some commentary on how it would go.
The UCMJ says this about disobeying lawful orders, in re: lawfulness:
An order requiring the performance of a military duty or act may be inferred to be lawful, and it is disobeyed at the peril of
the subordinate. This inference does not apply to a patently illegal order, such as one that directs the commission of a crime.
(ii) Determination of lawfulness. The lawfulness of an order is a question of law to be determined by the military judge.
So that lays out the framework. Let’s take the current policy directing discharge of members “experiencing gender dysphoria”. Say a commander decides they aren’t going to process one of their members for discharge despite it being mandatory to do so because that commander believes the policy is illegal.
If that commander went to a court-martial for disobeying a lawful order or regulation (Article 92), the order is: 1) presumed lawful, so despite the burden of proof being BARD at trial, the commander is going to be behind the 8-ball in needing to prove the order is unlawful; 2) there’s no way to get an advance opinion protecting the commander (“at the peril of the member”) and even if they went to a defense attorney or consulted with their servicing JAG*, and even if–as is unlikely–they were told the order was illegal, they still bear the risk (I suppose relying on your lawyer’s advice would be a matter in mitigation); and 3) it’s ultimately up to the judge, not the panel [jury].
Now, most instances where this come up probably aren’t going to court. More likely, they’d be handled administratively**. Someone who defies an order is given paperwork, not selected for promotion, or removed from their current position. All of this is still state action and subject to due process, but unless the order is patently illegal, no one is going to prevail if they argue that the order they disobeyed is unlawful in response to getting paperwork or removed from a position.
* if you think you might be in trouble you can consult with a defense attorney which works the way any defense attorney does, in that they represent you; the “servicing JAG” would be the office representing the service, not you, that could give you an opinion as a commander on what you should do. This would be the sort of thing I or my office would do.
** I do wonder if they’ll want to push to make an example of someone in court, since those are public, whereas administrative matters are supposes to be Privacy Act protected.
Now I am but a simple country blogger, but it’s hard for me to understand how an order to murder suspected drug dealers isn’t patently illegal, so I asked about that, along with a question about “given paperwork” means:
On the Venrzuelan example, the problem is going to be that any judge–especially a military judge, but I suppose an Art III judge is going to be reluctant too if it ever came up– is going to be very reluctant to find that POTUS-ordered strikes are illegal, even if the current situation is not all that ambiguous.
What’d be interesting there is there’s supposedly that OLC opinion floating out there somewhere providing a legal justification. If someone were prosecuted for refusing to destroy one of those boats, they’d assert it that it was an illegal order they had no duty to obey. The government would respond that it was legal. They might want to use, or at least rely upon, that memo. Problem is that it’s classified. If the classification authority (assume it’s someone high up at DOJ) refuses to declassify the memo, thats going to grind prosecution to a halt (unless a judge determines it isn’t necessary). And the one thing a judge absolutely cannot ever do in any circumstance is order the release of classified information. If it is needed in a case, and the government won’t release it, the only remedy is dismissal (or indefinite abeyance).
On giving someone paperwork, we have a series of administrative measures (slightly different between the services) that are collectively considered “paperwork.” In our case, Letters of Counseling, Reprimand, or (rarely, only for officers) Admonishment. They don’t carry other punishments (ie, no docking pay or reduction in rank), but they go in your personnel file for a period of time. They can affect promotion (esp for officers, although SECDEF recently announced a more “forgiving” attitude towards minor transgressions), and they can, in combination with multiple instances, establish a basis for administrative discharge.
Nothing as far as discharge is automatic. Especially if you have more than 6 years in, in which instance any attempt to involuntarily separate you (at least in the AF) gets you to a board, which is a mini trial in front of a jury. That might happen in one of these cases, and I can’t rule out court-martial, but most likely a person refusing an order to strike a random boat would probably be removed from their current position, given paperwork preventing future advancement, and reassigned to other duties.
BTW the fact that Trump can’t be prosecuted for any of this because of the Unspeakable Wisdom of John Roberts, Preserver of the Republic, and his Federalist Society Minions, is not relevant to the illegality of ordering people to be murdered because you supposedly suspect that they’re smuggling drugs. Nor is it any kind of defense for those people, should they be prosecuted in the future for following illegal orders.
The basic position of the Biden administration — that Donald Trump was a freakish aberration of some sort and can’t we just all get along going forward — looks increasingly catastrophic in retrospect, although hindsight is always 20/20 etc. As for foresight, any Democratic candidate for president who says anything that even in the most tenuous way indicates anything resembling a similar attitude should be disqualified instantly on that basis alone.
