This article originally appeared in Fortune.

In forcing the resignation of Navy Secretary Richard Spencer over his handling of the case of Navy SEAL Eddie Gallagher, President Donald Trump has intruded upon the military justice process. 

Spencer has acted honorably throughout the affair. In his resignation letter, he said he could not “in good conscience obey” Trump’s decision to reverse Gallagher’s demotion and allow him to keep his Trident pin.

“Military academy cadets study a key legal principle called unlawful command influence, when a commander uses or appears to use their authority to influence military judicial proceedings.”

“A generation of officers had to rebuild the war-fighting culture after Vietnam, which they did with great success, and the military is a rare institution that Americans say they still trust,” wrote the Wall Street Journal’s editorial board on Monday. “As commander-in-chief, Mr. Trump will undermine the officers under his command if he runs roughshod over their effort to maintain good order and discipline.”

In the words of former Navy Secretary Ray Mabus, Trump’s behavior in this situation “dishonors the military so much, and it causes chaos and confusion.” 

Military academy cadets study a key legal principle called unlawful command influence, or UCI. UCI is a legal concept within American military law, occurring when a commander uses or appears to use their authority to influence military judicial proceedings. Military commanders, despite having substantial authority and control, must take an objective, detached stance toward disciplinary proceedings such as a court-martial. This stance extends to administrative punishments as well, such as the removal of Gallagher from the SEALs. UCI may tarnish the results of a court-martial, which may be legally challenged and in some cases overturned as a result.

Among the ways a commander-in-chief could cause UCI are criticizing court-martial panel members for their findings, ordering specific sentences for certain crimes, or attacking legal teams. Based on these criteria, Trump is clearly exercising unlawful command influence. The Senate Armed Services Committee needs to step in and hold the president accountable for undermining the military’s command structure.

Congressional action is urgent, as Trump’s actions and statements are having a negative effect on our armed forces. Revered commanders such as James Mattis, H.R. McMaster, and John Kelly quit this administration in frustration with a naïve commander-in-chief who once declared, “I know more about ISIS than the generals do.” The military rank-and-file’s confusion, disillusionment with command, and erosion of morale can be a major threat to national security. 

Trump’s disrespect for military code has spread throughout his government. A recent Politico investigation detailed the surprising tolerance of government misconduct from the West Point class of 1986, which is now entrenched in the Trump administration and government: Secretary of Defense Mark Esper, Secretary of State Mike Pompeo, State Department officials Ulrich Brechbuhl and Brian Bulatao, and Rep. Mark Green. These men are trading their respect for military principles for personal gain. They do not serve the president or our nation well in their failure to hold the president to the code of justice which keeps our military strong.

The West Point honor code states, “A cadet will not lie, cheat, steal, or tolerate those who do.” Apparently graduation excuses former cadets from such high standards of personal integrity.

Unfortunately, we can’t rely on the president or his advisers to look out for the common good. Instead, we must place our hopes in honorable men like Richard Spencer, who has not abandoned his principles, to defend the armed forces’ core disciplinary process. Now that it’s clear Trump is meddling in the military’s command structure, the Senate needs to intervene and censure the president’s actions.

Eddie Gallagher has already mocked his fellow Navy SEALs and superiors for punishing his grotesque behavior. Congress can’t allow him, and our president, to mock the military’s legal process as well.