An intensifying Sino-U.S. rivalry on trade, security and other fronts is posing an increasingly tricky foreign policy challenge to South Korea, as it strives to keep its defence alliance with Washington and strategic partnership with Beijing.

The United States’ campaign to prod its allies to shun equipment from China’s telecom giant Huawei is a stark reminder that South Korea faces complex geopolitical choices with profound implications on its ties with the major powers.

The campaign was only the latest in a series of Seoul’s policy challenges, including Washington’s calls to join a push to maintain the “global commons,” or freedom of navigation in the South China Sea, against Beijing’s claim to most of the strategically crucial waterway.

“For South Korea, there isn’t a replacement for China in economic and trade terms, and no country can supersede the U.S. when it comes to South Korea’s security,” Kim Heung-kyu, a professor of China diplomacy at Ajou University, said.

“Making any overt choice between them will put South Korea in a very difficult position, a reason why Seoul has to conduct active preemptive diplomacy with both powers to avoid difficult situations,” he added.

In recent weeks, tensions between the U.S. and China have been escalating amid their gruelling trade negotiations in which Washington has sought to redress what it calls “unfair” Chinese trade practices, including Beijing’s state subsidies for high-tech industries.

Chinese critics have responded furiously to a series of U.S. demands, including restrictions on the transfer of American technology to Chinese firms, comparing them with the unequal treaties Beijing agreed to after the 1839-42 Opium War.

Last week, U.S. President Donald Trump declared a national emergency under an executive order that effectively bans American companies from using foreign telecoms’ equipment thought to pose national security risks in an apparent move against Huawei.

Washington has repeatedly made implicit calls for its allies to desist from using Huawei equipment, warning that it would not be able to partner with the countries should they use the Chinese firm’s products.

Seoul’s foreign ministry has said that Washington has stressed to it the importance of security for fifth-generation (5G) telecommunications equipment apparently produced by Huawei but refused to elaborate.

“South Korea and the U.S. have continued to have consultations over the issue, but we call for your understanding as we cannot go into detail about the content of the consultations,” the ministry said in a text message sent to reporters.

Japan, a key ally of the U.S. and a longtime regional rival to China, appears tightly aligned with the American security policy. Tokyo has reportedly moved to ban government purchases of Huawei equipment.

But analysts said that South Korea can hardly embrace such a choice like Japan, given that China is a crucial partner not only for trade and tourism but also for ongoing efforts to denuclearise North Korea and foster a lasting peace on the peninsula.

China, the only major economic patron for the impoverished state, is seen as having extensive influence over its communist ally. It is also a party to the armistice agreement that halted the 1950-53 Korean War.

To navigate through the complex geopolitics, analysts called for Seoul to craft a well-thought-out policy that best promotes its interests.

“We need to clearly and accurately calibrate what is in our best interests in a broad context and in due consideration of all factors, rather than just focusing on inter-Korean relations,” Nam Chang-hee, a professor of international politics at Inha University, said.

On a purely security front, the policy challenge for South Korea is far starker.

China still vehemently opposes the U.S. installation of an advanced anti-missile system in South Korea, which Washington and Seoul have argued is designed only to counter Pyongyang’s nuclear and missile threats.

Beijing, however, believes that the addition of a U.S. strategic asset could tip the regional security balance in favor of Washington, at a time when China appears intent to expand its sphere of influence further into the Pacific.

The United States’ freedom of navigation drive aimed at securing key maritime trade routes particularly in the South China Sea is another geopolitical fault line.

Washington has reportedly demanded that Seoul support its drive amid Beijing’s claim to the South China Sea with “the nine-dashed-line” — a boundary that takes in more than 90 percent of the waterway where the world’s crucial sea lines of communication coalesce and where massive oil and natural gas fields are thought to lie.

China has been sticking to its territorial assertions, unbowed by the 2016 ruling by an international tribunal in The Hague against the territorial claims.

South Korea has been trying to steer clear of territorial disputes in the South China Sea, involving various claimants, but has maintained that the maritime issues should be settled through a peaceful resolution.

The geopolitical strategies of the two major powers could also pose a daunting diplomatic challenge to Seoul.

The U.S. has been pushing for a “free, open” Indo-Pacific strategy that many argue is aimed at reining in an increasingly assertive China and cementing its preeminence in the region, now a fulcrum of global power and wealth.

China has been pressing ahead with the “One Belt, One Road” infrastructure initiative, seen as a grand strategy to connect China with Southeast Asia, Central Asia, Europe and Africa through “land and maritime silk roads.”

Seoul has been studying both strategies, cautious not to risk entanglement in any potential geopolitical spats between Washington and Beijing.