During 2017 North Korea conducted a series of high-profile missile tests. These included a trial of its highest travelling intercontinental ballistic missile.
In total the North Koreans fired about two dozen missiles.
According to Bob Woodward, author of ‘Rage’, this so concerned General Mattis that he went to sleep wearing his clothes in case there was a North Korean nuclear launch.
North Korea is estimated to have an arsenal of 30-40 nuclear warheads.
The book reveals Mike Pompeo, Mr Trump’s secretary of state, was also worried about open war breaking out.
Speaking to Mr Woodward he said: “We never knew whether it was real or whether it was a bluff.”
Mr Woodward, who became renowned for his reporting during the Watergate scandal, has published books on a number of American presidents and their administrations.
For his latest work he interviewed a number of prominent Trump administration officials and also held 18 sit-down interviews with the president himself.
The inflammatory new book is due to be released on September 15.
READ MORE: Donald Trump blasts former official for exposing North Korea letters
The president also took to calling North Korean dictator Kim Jong-un “little rocket man”.
General Mattis went on to resign from Mr Trump’s administration in December 2018 in protest at a planned US troop withdrawal from Syria.
In his resignation letter he wrote: “Because you have the right to have a Secretary of Defense whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down from my position.”
According to the new book General Mattis regarded Mr Trump as “dangerous” and believed he had taught US enemies “how to destroy America”.
He is reported to have offered his resignation “when I was basically directed to do something that I thought went beyond stupid to felony stupid”.
Relations between the Trump administration and North Korea improved markedly after the initial dispute.
In June 2018 Mr Trump became the first US president to meet a North Korean leader when the pair held a summit in Singapore.
This was followed up the next year with meetings in Vietnam and on the North-South Korean border.
At a campaign rally in 2018 Mr Trump said he had also been exchanging letters with Kim Jong-un.
He commented: “I was really being tough and so was he.
“And we would go back and forth. And then we fell in love. No really. He wrote me beautiful letters.”