HALIFAX -- The top commander of U.S. nuclear forces says he would push back if U.S. President Donald Trump asked him to carry out an order he deemed "illegal."

Air Force Gen. John E. Hyten told the Halifax International Security Forum on Saturday that he and Trump have discussed what would happen if the president ordered a nuclear strike he believed to be unlawful under international law.

"I think some people think we're stupid. We're not stupid people," Hyten said."We think about these things a lot. When you have this responsibility, how do you not think about it?"

Hyten would be in charge of U.S. nuclear forces in a war. If Trump decided to launch a nuclear attack, Hyten would provide him with strike options, and the president would make his decision.

"The way the process works, it's simple," said Hyten. "I provide advice to the president, he'll tell me what to do, and if it's illegal, guess what is going to happen?

"I'm going to say, 'Mr. President, that's illegal.' And guess what he's going to do? He's going to say, 'What would be legal?"'

Hyten said he and Trump would work to find another course of action.

Hyten said he is trained every year in the laws of armed conflict ---which are guided by principles that include necessity. Under that framework, carrying out an illegal order is a punishable offence.

"If you execute an unlawful order, you will go to jail," he said. "You could go to jail for the rest of your life."

Hyten made the remarks while participating on a panel called "Nukes: The Fire and the Fury," an apparent reference to Trump's threats to unleash "fire and fury" on North Korea this summer.

Hyten said the U.S. can defend itself against North Korea's nuclear threats.

"Can we live with a nuclear North Korea? The answer is yes," said Hyten. "The question we have to ask ourselves is: Do we want to live in that world?"

With files from The Associated Press.