H.R. McMaster, President Trump’s national security adviser, said Saturday that the possibility of war with North Korea increases every day the problem over its nuclear program isn’t solved.

“I think it’s increasing every day,” McMaster told Fox News’ Bret Baier at the Reagan National Security Forum in California. “It means we’re in a race. We’re in a race to be able to solve this problem.”

Added McMaster: “There are ways to address this problem short of armed conflict, but it is a race because he’s getting closer and closer and there’s not much time left.”

Last week, North Korea fired its highest-ever intercontinental ballistic missile, flying 1,000 miles higher than during its first ICBM launch in July.

McMaster told Baier that North Korea dictator Kim Jong Un’s nuclear ambitions are the gravest national security threat that America faces.

“The greatest immediate threat to the United States and to the world is the threat posed by the rogue regime in North Korea and his continued efforts to develop a long range nuclear capability,” he said.

McMaster added, “So it’s immensely important that we work together with all of our allies, partners, everyone internationally, to convince Kim Jong Un that the continued pursuit of these capabilities is a dead end for him and his regime.”

TRUMP ON NORTH KOREA MISSILE LAUNCH: 'WE WILL TAKE CARE OF IT'

A senior U.S. official told Fox News on Saturday that the North Korean ballistic missile fired last week did not survive the re-entry to the Earth's atmosphere, but broke up on reentry.

Still, the president’s national security adviser said North Korea is improving every time it conducts a test, even when it fails.

“What is clear is every time – every time -- he conducts a missile launch, a nuclear test, he gets better,” McMaster said. “And whether it’s a success or failure isn’t as important as understanding that over the years he’s been learning from failures, improving, thereby increasing his threat to all of us.”

During the forum at the Ronald Reagan Presidential Library in California, McMaster denied that the recent guilty plea of his predecessor, former national security adviser Michael Flynn, on Friday has rattled allies.

Speaking of special counsel Robert Mueller’s investigation into Russia’s meddling in the election, McMaster said: “I’ve seen no evidence of the investigation in any way impeding the important work we’re doing.”

Fox News’ Jennifer Griffin contributed to this report.