WASHINGTON (WASHINGTON POST)- President Donald Trump has thanked China for helping rein in North Korea and claimed that international pressure on the nuclear-armed outlaw nation is beginning to work, marking a change in tone amid concerns that tensions with Pyongyang are escalating dangerously.

Trump made a point of praising Chinese President Xi Jinping for his efforts to squeeze Chinese ally North Korea economically and diplomatically. In other settings - usually Twitter - Trump has complained about lacklustre Chinese cooperation and suggested he could punish China economically if it did not do more.

"I applaud China for breaking off all banking relationships with North Korea, something that people would have thought unthinkable even two months ago," Trump said.

"I want to thank President Xi."

Although the president repeated a threat of military action, his language was mild by comparison to his branding of North Korean leader Kim Jong Un as "a madman" and his vow last week to "totally destroy" North Korea if necessary to protect the United States or its allies.

"We are totally prepared for the second option. Not a preferred option, but if we take that option, it will be devastating -- I can tell you that -- devastating for North Korea," he said at a White House press conference with Spanish Prime Minister Mariano Rajoy Brey.

"That's called the military option. If we have to take it, we will."

His remarks came in response to North Korea's threat a day earlier to shoot down approaching American bombers even in international air space.

Related Story France says Trump method not best way to tackle North Korea crisis; China calls for dialogue

Related Story North Korea's fighter jets moved to coast after US show of force

Related Story Rex Tillerson to discuss North Korea crisis, trade in China

Related Story Top US general Joseph Dunford says North Korea's military posture remains unchanged amid tensions

North Korean Foreign Minister Ri Yong Ho on Monday accused Trump of declaring war on the North and threatened that Pyongyang would shoot down US warplanes flying near the Korean Peninsula after American bombers flew close to it last Saturday. Ri was reacting to Trump’s Twitter comments that Kim and Ri“won’t be around much longer” if they acted on their threats toward the United States.

Referring to North Korean leader Kim Jong Un, Trump said during the news conference on Tuesday, "He's acting very badly. He's saying things that should never ever be said."

Trump said the US was responding to Kim's provocations, but insisted his replies were merely in response to rhetoric from Pyongyang.

He also decried the situation there, saying he was left a "mess" by previous administrations.

"North Korea is a situation that should have been handled 25 years ago, 20 years ago, 15 years ago, 10 years ago, and five years ago, and it could have been handled much more easily," Trump said.

"Yet various administrations, many administrations - which left me a mess. But I'll fix the mess."

"We'll see what happens," Trump said in comments that were also carried by CNN and South Korea's Yonhap news agency.

The president's remarks on Tuesday appear to reflect an attempt at lowering the temperature after days of heated rhetoric and threats from both sides.

During his first address to the United Nations last week, Trump repeated his dismissive nickname for Kim, "Rocket Man", and shocked some UN diplomats with an open threat of warfare.

The possibility of conflict appeared to worsen after the annual diplomatic gathering of the UN General Assembly, with the US launching a symbolic B-1 bomber flight off the North Korean coastline.

North Korea's top diplomat said on Monday that Trump had effectively declared war on the rogue nation and that Pyongyang could shoot down a US warplane at will.

Trump's statements on Tuesday closely echo the more diplomatic message being delivered in public and private by top administration officials, who present the threat of military action as part of a coordinated strategy to slow down North Korea's weapons programme and impress upon Kim that these weapons are ultimately a liability.

That is the message delivered by Secretary of State Rex Tillerson, national security adviser H.R. McMaster and other officials, who have sought to reassure foreign diplomats after some of Trump's more florid threats.

There have been no public defections from the diplomatic coalition condemning North Korea's recent escalation in its nuclear and ballistic missile tests, as Trump noted Tuesday.

"I appreciate the United Nations Security Council voting twice, unanimously 15 to nothing, twice - to adopt hard-hitting resolutions against North Korea," Trump said.

Spain is among the countries which have complied with the Trump administration's request to downgrade diplomatic ties with North Korea in response to its nuclear and missile programme.

"No one wishes for there to be a war anywhere in the world," Rajoy said through an interpreter. "We will have to be forceful, and those of us who defend the values of democracy, freedom and human rights have to let North Korea know that it isn't going anywhere in that direction."

Just before Trump spoke in the Rose Garden, the Treasury Department announced new sanctions on eight North Korean banks, 26 people in China and three other countries that the Trump administration says are linked to North Korean financial networks.

The penalties come on top of unilateral US sanctions announced last week that are meant to close off the US financial system to Pyongyang and anyone doing business with it, as well as the international import and export restrictions approved since early August.

The Trump administration says there are signs that North Korea is starting to feel the pinch from international pressure, especially with the addition of restrictions on fuel oil and other forms of energy that will affect the ruling elite.

The penalties have not yet worked to deter Kim, who says the United States is bent on war.

"Reversing strategic patience was the first foreign policy decision the Trump administration made," State Department adviser R.C. Hammond said, referring to the prior policy of waiting Kim out.

"There's no more time to wait while North Korea develops its nuclear capabilities."

The international pressure campaign involving China was born out of that decision and Trump's successful summit with Xi at his Mar-a-Lago resort in Florida this year, according to Hammond.

"Strategies work when we stick to them," he said.

Many US officials have concluded that Kim is determined to present the United States with a fait accompli - a nuclear bomb that could be delivered to the mainland United States - before it becomes clear whether he would enter a meaningful negotiation. The Trump administration says it will not tolerate a strategy of nuclear containment against Kim and that the goal of any negotiation would be for Pyongyang to give up its weapons.

China is the linchpin, since Beijing is both North Korea's main economic partner and traditional protector. Chinese banks and other financial entities have been a lifeline for Kim's regime, and although China has cut many ties and helped impose international sanctions, U.S. officials say that cracks remain.

The United States has led a pressure campaign to get other nations to stop doing even minimal trade or banking business with North Korea, and to cut or downgrade diplomatic relations with Pyongyang. Those efforts are on top of stricter economic penalties imposed at the United Nations in the past two months.

The State Department announced on Tuesday that Tillerson will travel to Beijing this week for talks on North Korea, trade and other issues, including Trump's visit to China later this year.

US State Department spokeswoman Heather Nauert stepped around the question of whether Trump's name-calling or threats issued via Twitter are a helpful part of the U.S. strategy.

"The president is an effective communicator. I think people know exactly where he stands. We have had a good deal of success in pushing forward with our diplomacy campaign," Nauert said.

"The president has done a strong job" of leading that diplomacy, she said. "Some may not want to give him credit for that."