Washington CNN  — 

Damaging portraits of President Donald Trump are drawing new attention to the options available to military commanders who feel they have been given an illegal or seriously ill-advised order by their commander in chief.

A New York Times op-ed penned by a “senior official” and excerpts from a new book by Bob Woodward portray Trump as erratic, impulsive and dangerously incurious on matters of national security. The publications illustrate how some of Trump’s top advisers believe the President of the United States is unfit to be the most powerful man in the world and have sought to circumvent or undermine his demands.

Defense Secretary James Mattis is among those top officials, according to confidential background interviews conducted by Woodward, who writes that the defense secretary reportedly made disparaging comments about Trump and military actions he sought to take against Syria and North Korea.

Woodward depicts a furious Trump demanding that his military officials have Syrian President Bashar al-Assad assassinated after his regime was accused of conducting a chemical attack against civilians in April 2017. And after a charged meeting about South Korea, during which Trump wondered why the US backs Seoul, Woodward writes that Mattis says Trump understands issues at the level of an elementary school student.

Mattis has denied those assertions, and the accounts detailed by Woodward’s sources, including claims that Mattis has ignored or slow-rolled Trump’s ideas, seem to fall short of challenging a direct order.

But allegations that Mattis is intervening regularly to avert national security disasters have once again raised the question of whether military commanders possess the authority to refuse a direct order from the President under certain circumstances.

The reality is that the only basis for interfering with a direct order is if it’s illegal, immoral or unethical. And there is a widely held belief among military commanders that they must resign if they are unable to carry out an order that does not rise to that standard.

Speaking publicly on the issue last November, Gen. John Hyten, top US nuclear commander, said he would push back against an order from Trump for a nuclear strike if it were “illegal.”

“I provide advice to the President,” Hyten said. “He’ll tell me what to do, and if it’s illegal, guess what’s going to happen? I’m gonna say, ‘Mr. President, that’s illegal.’ Guess what he’s going to do? He’s going to say, ‘What would be legal?’ And we’ll come up with options of a mix of capabilities to respond to whatever the situation is, and that’s the way it works. It’s not that complicated.”

While the President retains that authority, Hyten publicly emphasized that the US military always has the obligation to follow only legal orders, including those entailing the launch of nuclear weapons.

Hyten’s remarks followed a Senate Foreign Relations Committee hearing on the President’s authority to launch nuclear weapons – the first such congressional hearing in more than 40 years.

During that hearing, retired Air Force Gen. Robert Kehler, who served as the commander of US Strategic Command under President Barack Obama, explained that there are layers of safeguards within the system designed to ensure any order is legal and proportionally appropriate.

“US nuclear forces operate under strict civilian control. Only the President of the United States can order the employment of US nuclear weapons,” Kehler said.

“This is a system controlled by human beings … nothing happens automatically,” he said, adding that the US military does not blindly follow orders and a presidential order to employ nuclear weapons must be legal.

CNN military analyst John Kirby explained that military judge advocates and general counsel are active participants in the decision-making process at virtually every level, from the tactical to the strategic.

“They help ensure that political appointees and uniformed commanders fully understand and consider law of war principles, as well as the dictates of congressional legislation, before any final decision is reached regarding the use of armed force in defense of the nation, particularly during the planning of combat operations,” he said.

“Given this level of integration, it’s a rare thing for orders given to troops to be illegal or unlawful on their face,” Kirby added, noting that incidents like Abu Ghraib – in which US service members abused Iraqi detainees – serve as examples of how this can happen.

“And in the event that there ever was reason to question the legality of orders, subordinate commanders and appointed leaders have the duty, responsibility and official lines of communication to do so – to have that conversation right up the chain of command,” he said.

This story has been updated.

CNN’s Barbara Starr contributed to this report.