SEOUL — The widening trade war between the United States and China endangers peace on the Korean peninsula for one basic reason: It’s driving China ever closer to North Korea while strengthening the North’s negotiating position against the United States.

Advisers to President Donald Trump are worrying about the effect of tariffs and retaliatory tariffs imposed by both these giants on the security of South Korea and the region at a time when North and South Korea appear to be improving in the run-up to President Moon Jae-in’s summit with Kim Jong-un on April 27. Indeed, North Korea has even scaled down its anti-American rhetoric in anticipation of a possible summit between Kim and Trump in May.

In the middle of what would appear to be a remarkable decrease in tensions, however, the battles between the United States and China threaten to put the whole process in reverse. That’s because Trump is determined to do something about China’s enormous trade surplus with the United States, nearing $400 billion this year, while China’s President Xi Jinping seems equally hell-bent on defending his country against what he sees as unscrupulous attempts at repressing China’s advance as a productive, highly competitive superpower.

So where does that standoff between these two giants leave the Korean peninsula, North and South — relatively small entities colonized by Japanese imperialists in the early 20th century; divided by conquering World War II powers, the United States and Japan; then embroiled in one of Asia’s bloodiest wars after the North Korean invasion of South Korea in 1950 and caught ever since in the cauldron of great power rivalries?

The answer is that, even as North-South tensions are perhaps over-optimistically believed to be decreasing, they are likely to spike up again while China, outraged at U.S. tariffs, stops supporting U.N. sanctions against the North while guaranteeing Kim Jong-un the assurances he needs to stand firm against both South Korea and the United States. “It’s only logical for Kim to take heart from what he sees going on between Washington and Beijing,” said one analyst. “He knows that he stands to benefit. Xi Jinping is not going to crack down too hard while facing Trump.”

A sure sign of North Korea’s eagerness to exploit the U.S.-China trade war was an editorial in Rodong Sinmun, the newspaper of the North Korea’s ruling Workers’ Party, extolling what it called “the revolutionary friendship” between Kim’s grandfather, Kim Il-sung, founder of the ruling Kim dynasty and still revered as the North’s “eternal president,” and Zhou Enlai, the Chinese premier who was Mao Zedong’s right-hand man until his death in 1976.

Kim Il-sung, it seemed, made a special trip to Beijing in 1975 just to see Zhou as he was bedridden. “The tearful encounter,” said Rodong Sinmum, “left people around them overcome with emotion.” Indeed, the paper said, he had visited Beijing a number of times over the years reflecting not only their close comradeship but also their belief in the same revolutionary ideals.

The commentary, published so soon after Kim Jong-un made his first visit to Beijing as North Korean leader as the guest of President Xi, showed North Korea’s eagerness if not anxiety to win China’s favor as a client state that had suffered from Chinese pressure, at the urging of the Americans, to get rid of its nuclear program. If Kim as heir to the legacy of his grandfather and father, is to get in China’s good graces again and escape from under U.N. sanctions, then he would be free to pursue his own “revolutionary” policies against South Korea.

But would the scheme really work? Might North Korea’s hopes be frustrated as the Americans and Chinese moved to resolve severe differences?

American and South Korean analysts had to believe the trade war might be of short duration in a volatile roller-coaster ride. Trump’s economic adviser, Larry Kudlow, said perhaps Trump would not order all the tariff increases before Trump said he might order still more.

Hopes rose after a report issued by the Korea International Trade Association predicted the feuding superpowers would come to terms. “It is possible the two sides will engage in negotiations to produce a compromise deal,” said the report, noting that “any implementation of retaliatory tariffs will cause catastrophic losses on the economies of the U.S. and China.”

The implications for South Korea were significant. South Korean companies with factories in China that produced products for export to the United States or companies inside Korea exporting via China “will likely be hurt,” according to the report. All these Korean firms, it said, needed to see if any of their products were among those affected by the new U.S. tariffs.

The U.S.-China trade war, though, seems sure to keep boiling, playing into the confrontation between the two Koreas as China seeks to manipulate relations with North Korea, the ally that it rescued from annihilation in the Korean War, while the United States maintains its no-compromise policy in pursuit of complete, verifiable irreversible denuclearization.

The Chinese know they wield a powerful lever against Trump simply by blowing hot and cold on sanctions against the North, and the North Koreans sense the Chinese won’t keep up the pressure too strongly while focusing on the trade war with the United States. As for South Korea, Trump has avoided a trade war by a compromise that Moon endorses.

“We want to get along with both the U.S. and China,” said one knowledgeable observer, “ but we’re afraid Kim Jong-un will not want to make concessions on his nuclear program if he can win back friendship with China just like his grandfather and father.”