Consider what is, for the moment, an entirely hypothetical question: What might Defense Secretary Jim Mattis do if he received an order from President Trump to launch a nuclear attack on North Korea in retaliation, say, for a hydrogen bomb test that had gone awry?

Certainly, Mattis could try to talk the president out of the attack, if he thought the action was unwise. He could request delays to prepare for contingencies or gather intelligence. He could even, perhaps, argue that the action raised legal questions, because it might cause disproportionate civilian casualties in North and South Korea and thereby violate the laws of war.

Yet, in the end, legal experts argue that Mattis would have to follow the orders of his commander in chief. That's the way our system works. If Mattis's efforts at persuasion failed, he could resign. But if he stayed on the job and refused a lawful presidential order, he could be fired.

"The president's view, and whatever orders stem from that view, carry the day," wrote Jack Goldsmith, a Harvard University professor and a widely respected authority on national security law, in a recent post on the Lawfare blog. (Harvard law student Sarah Grant co-wrote the post.)

But take a closer look if you worry that Trump's impulsive decisions could crash the ship of state against the rocks. Research reveals some fascinating instances when another erratic president, Richard Nixon, was checked by his subordinates.

Let's start with a little-known confrontation that involves, yes, North Korea. On April 14, 1969, North Korean fighters shot down a Navy EC-121 reconnaissance plane over international waters, killing all 31 crew members. Nixon wanted to retaliate militarily, as did his national security adviser, Henry Kissinger. But Defense Secretary Melvin Laird was wary, fearing that the United States wasn't ready for the consequences that might follow.

So Laird slow-rolled the process. He delayed action. He presented studies. He halted the additional surveillance flights needed to gather intelligence before a strike. Citing a Pentagon logistics study, he told Nixon that he doubted "we have the capability now to handle a major confrontation in Korea."

And Laird prevailed. The retaliatory strike Nixon wanted never happened. Reading the account by Richard Hunt published by the Historical Office of the Secretary of Defense, it seems that Laird accomplished a classic case of bureaucratic obstruction.

Nixon could make mercurial, intemperate statements, much like Trump. In August 1969, terrorists hijacked a TWA flight and flew the plane to Damascus, Syria. According to Evan Thomas in "Being Nixon," the president received the news as he was having cocktails in San Clemente, Calif.

"Bomb the airport," Nixon ordered. This time, Kissinger was cautious. Thomas quotes him as deciding "to give the president the opportunity to have second thoughts." Kissinger slowed movement of aircraft carriers to the eastern Mediterranean. Laird was also wary. He planned to cite "weather delays" to tarry the carriers even more.

The next morning, while being briefed on carrier movement, Nixon asked Kissinger if "anything else" had happened. Kissinger said, "No," and Nixon answered, "Good." Kissinger wrote later that he "never heard another word about bombing Damascus."

A final example of sand in the presidential gears comes from Jeffrey H. Smith, a former CIA general counsel who during the Nixon era was a young Army lawyer. Smith recalled in a recent post on Just Security that in 1974, a few days before Nixon's resignation, he was shown a message from the chairman of the Joint Chiefs of Staff to subordinate commanders, advising that if they received any White House "execute orders" to use force, they should confirm them first with the chairman or the secretary of defense.

Thomas explains in his book: "Worried that the president might do something desperate, Defense Secretary James Schlesinger passed the word that all commands to the troops from the White House must pass through him." Schlesinger later claimed that he just wanted to reinforce the chain of command. This episode has also been explored by Garrett Graff in Politico.

What could our imaginary Mattis do if he tried similar methods of caution but the president still wanted to launch what Mattis and his commanders viewed as an unwise attack?

Well, there's a remedy for that in our Constitution. The 25th Amendment provides that the vice president and a majority of the Cabinet officers can inform Congress that the president is unable "to discharge the powers and duties" of his office. The vice president would take over, unless more than a third of the House and Senate backed the president.

But mind you, this is all hypothetical. As the Nixon stories show, even the most willful presidents usually end up listening to Pentagon advice.

Read more from David Ignatius's archive, follow him on Twitter or subscribe to his updates on Facebook.