The job of US defence secretary is a demanding one at the best of times. But for James Mattis, a former Marine Corps general, the problems are not confined to Iraq, Afghanistan and Isis. One of the biggest challenges facing the Pentagon’s new chief lurks in the White House, just across the Potomac river. His name is Donald Trump.

Mattis made his first overseas trip as “defsec” last week, and his choice of destination was instructive. Rather than visiting the Middle East or Nato allies in Europe, he travelled to South Korea and Japan. During his presidential campaign, Trump alarmed both countries by demanding that they pay more for their own defence and even acquire nuclear weapons.

During talks in Seoul and Tokyo, Mattis’s priority was to provide reassurance that, whatever Trump says, the US remains a reliable ally. It was an important moment. Threats to peace and security across east Asia are multiplying, thanks to expansionist China and nuclear-armed North Korea. An arms race is accelerating, and the US currently has about 80,000 troops in bases in Japan and South Korea.

But Mattis’s “keep calm and carry on” mission got no help on the home front. No sooner had he boarded his plane than the White House began behaving like the gang that couldn’t shoot straight. A furious row erupted with another regional ally, Australia, over refugees. Trump ordered a special forces covert operation in Yemen that went disastrously wrong. And Michael Flynn, his aggressive national security adviser, threatened war with Iran. Reassuring it wasn’t.

When first mooted, the appointment of the experienced Mattis was interpreted as a signal that grown-ups would still be in charge in Washington. It was suggested he would tame Trump and the ideologues in his inner circle. That theory is looking threadbare right now, making it all the more important that Mattis succeed in soothing nerves in east Asia.

His task is daunting. The region increasingly resembles a powder keg with a short fuse. China’s claim to sovereignty over almost all the resource-rich South China Sea, a major international trade route, is hotly disputed by several neighbours. Its militarisation of artificial islands continues apace, despite a UN court ruling last year declaring it illegal.

A similar dispute is simmering over the Japanese-controlled, uninhabited Senkaku islands (Diaoyu in Chinese), in the East China Sea. Beijing’s supporters have also at times laid claim to other islands in the Ryukyu chain, including popular tropical Ishigaki, 100 miles south of the Senkakus and 300 from mainland China.

Japan is pushing back. The government has set a record defence budget of $43.6bn. It has reinterpreted Japan’s pacifist constitution, allowing its Self-Defence Force to act more freely. And prime minister Shinzo Abe has boosted coastguard and naval patrols in disputed areas. There are reports of almost daily Chinese incursions, including the unprecedented Pacific deployment of an aircraft carrier from China, the Liaoning.

Mattis, meanwhile, must also try to neutralise inflammatory statements by Trump and his allies. Rex Tillerson, the new US secretary of state, has said that China should be denied access to its artificial-islands base in the South China Sea – an aim that could only be achieved by military force.

The Senkaku islands in the East China Sea. Photograph: Kyodo News via Getty Images

Trump himself has repeatedly goaded China over Taiwan, suggesting he might tear up the “One China” policy, the diplomatic stance that has kept the peace since the 1970s.

So far Xi Jinping, China’s strongman president, has held back. But Xi is under pressure at home over falling economic growth and endemic corruption before a vital Communist party congress this autumn. He insists China will vigorously defend all its maritime claims, and has put the squeeze on Taiwan. Chinese ships recently seized a US underwater drone. Far worse could follow if Xi is provoked.

Mattis will hope to prevent relations with China deteriorating further. But far from calming tempers, his visit to Seoul may have aggravated tensions. Mattis confirmed the deployment in South Korea of a new missile defence system intended to deter North Korea. China says the state-of-the-art Terminal High Altitude Area Defense (Thaad) system is a disproportionate response to a perceived threat that upsets the strategic balance.

The green light for Thaad could also provoke the Pyongyang regime, which has been relatively quiet in recent months. Analysts say Kim Jong-un, North Korea’s dictator, is waiting to see how the Trump administration shapes up and who replaces South Korea’s disgraced president, Park Geun-hye.

But Kim, who conducted two nuclear tests in 2016, says he is ready to test-launch an intercontinental ballistic missile (ICBM). North Korea has also restarted operation of a plutonium-producing reactor at its Yongbyon centre. On Friday, Mattis warned North Korea of an “overwhelming” US military response if it used nuclear weapons.

But on North Korea, too, Trump is undermining attempts to keep the peace. A North Korean nuclear-armed ICBM could, in theory, hit the continental US, 5,500 miles away. Last month Trump boastfully tweeted “It won’t happen!” What did he mean? Does he favour a pre-emptive strike? Nobody, his defence secretary included, seems to know.