Such comments clearly resonated with Mr. Han and top Defense Ministry officials, all of whom are retired or serving military officers and who have had close interactions with American troops. Mr. Mattis is a retired four-star general.

“‘Mad Dog’ Mattis in South Korea was unexpectedly soft,” read a headline in OhMyNews, a widely read online newspaper. It observed that Mr. Mattis, despite his nickname, was considered the most prudent among Trump administration officials when it came to military action because he had seen what war was like.

In Japan, Mr. Mattis sought to carry out a similar balancing act. During the campaign, Mr. Trump threatened to walk away from the mutual defense pact unless the Japanese did more to reimburse the United States more for defending their territory.

But speaking at a joint news conference with his Japanese counterpart on Saturday, Mr. Mattis said that the United States stood by the pact, reiterating that the American defense commitment extended to disputed islands in the East China Sea, known in Japan as the Senkaku and in China as the Diaoyu. Mr. Mattis also described Japan as “a model of cost sharing” and praised the administration of Prime Minister Shinzo Abe for increasing spending on the military.

Strikingly, Mr. Mattis expressed caution about using military force. In contrast, Rex W. Tillerson, Mr. Trump’s new secretary of state, suggested during his confirmation hearing that the United States should be prepared to block China’s access to the islands that it has claimed in the South China Sea and built up with airfields, ports and weapons.

“We’re going to have to send China a clear signal that first, the island-building stops, and second, your access to those islands is also not going to be allowed,” Mr. Tillerson told the Senate Foreign Relations Committee last month.

Mr. Mattis has long argued that diplomacy should be backed up by military might, but that force should not be the first recourse. In the case of the South China Sea, he said, it is the diplomats who should be carrying the ball.