US President Donald Trump ruled out any talks with North Korea, which fired a ballistic missile that flew over Japan, forcing people to seek shelter.

However, his Secretary of Defense Jim Mattis said that there was still room for diplomacy in dealing with North Korea’s ballistic missile launches.

The missile flew over Hokkaido island before crashing into the northern Pacific Ocean. This is the first time North Korea has fired what is thought to be a ballistic weapon over Japan.

“The US has been talking to North Korea, and paying them extortion money, for 25 years. Talking is not the answer!” Trump tweeted.

Hours later, Defence Secretary Mattis said that the US is not out of diplomatic solutions yet on North Korea.

“No,” Mattis told reporters when he was asked about Trump s tweet in this regard during a welcome ceremony for his South Korean counterpart at the Pentagon.

“Secretary Mattis, you have often said you seek a diplomatic solution to North Korea. The president this morning tweeted that talking isn’t the answer. Are we out of diplomatic solutions for North Korea?” Mattis was asked.

“We’re never out of diplomatic solutions,” he replied.

“We continue to work together and the minister and I share responsibility to provide for the protection of our nation our populations and our interests, which is what we are here to discuss today,” Mattis said.

Responding to a question, he said, “look for all the areas we can collaborate – there is already very strong collaboration, we always look for more, we are never complacent.”

A day earlier, Trump had warned a defiant North Korea that “all options are on the table”.

“But you said ‘all’ options were on the table. The negotiating table itself should be one of them. Don’t discount the power of dialogue,” tweeted former State Department spokesman John Kirby.

“I doubt Trump taking diplomacy with NK (North Korea) off table was coordinated with Asian allies or will go down well there. Stakes too high for improv,” tweeted Ben Rhodes, a top White House National Security Official during the Obama administration.