TAIPEI, Taiwan — As President Trump battles it out with China over trade and the mood in Washington sours toward Beijing, there is a growing fear that Taiwan will end up suffering the consequences.

“When two elephants are dancing, we must take care not to be stamped upon,” said Jason Lin Chun-hsien, a legislator for the ruling Democratic Progressive Party. “Today you yell at each other, but tomorrow maybe you shake hands. We must try to avoid becoming a bargaining chip.”

A Sino-U.S. trade war could seriously damage Taiwan’s ­export-oriented economy. More than half of its exports go to China, mostly parts and intermediate goods that are then assembled and exported to consumers in countries such as the United States.

But the tectonic plates of international diplomacy are also moving in a way that could send shock waves through Taiwan. 

Ever since Tsai Ing-wen was elected president of Taiwan in 2016, Beijing has signaled its displeasure with her stand-alone attitude. China has been stepping up its campaign to isolate Taiwan internationally, while its military flexes its muscles. Outright conflict, for now, remains unlikely, but the narrow Taiwan Strait is reemerging as one of Asia’s most dangerous potential flash points, experts say.

Last month, Trump signed the Taiwan Travel Act into law, after unanimous votes in both houses of Congress. Recognizing Taiwan as a “beacon of democracy in Asia,” the act declares that it should be U.S. policy to send officials at all levels to Taiwan and allow high-level Taiwanese officials to visit their counterparts in Washington. 

While some experts have played down the act as “not legally binding,” Julian Ku, a professor at Hofstra University’s law school, said that underestimates its significance. He called it a “statutory declaration of policy” that the administration has an obligation to observe, even if there are no penalties for failing to do so. 

Similar policy declarations, such as a 1998 vow to remove Saddam Hussein from power in Iraq and the 1992 Cuban Democracy Act, had significant impacts on foreign policy. 

“Because such declarations reflect the agreement of both houses of Congress and the president, it is hardly surprising that, as the Iraq and Cuba examples should remind us, such statutory declarations of policy often prevail as actual U.S. foreign policy,” he wrote. “We can and should expect the Taiwan Travel Act to shape U.S. Taiwan policy in the near and long term.”

After Trump signed the act, China’s government lodged “stern” objections, warning Washington of potentially serious damage to the foundations of their relationship. 

The nationalist Global Times newspaper recommended striking back by blacklisting from visits to the mainland any U.S. officials who travel to Taipei, and even preparing for a possible “direct military clash” in the Taiwan Strait.

The appointment of John Bolton as national security adviser has also raised the stakes. Writing in the Wall Street Journal in January, Bolton said Washington should “play the Taiwan card” against China, even to the point of redeploying some U.S. Marines from Okinawa to Taiwan, or granting Taiwan full diplomatic recognition if Beijing refuses to back down in the South China Sea.

Either of those moves would be seen in Beijing as firmly crossing a line.

“Taiwan needs the United States’ strong support, but it should be wary that this not tip toward belligerence,” said Margaret Lewis, a professor at Seton Hall Law School currently working in Taiwan.

“Especially with so many global flash points that could quickly divert the U.S. government’s attention, a concern is that the U.S. might take an outspoken stance on Taiwan and then suddenly soften its tone, which could leave Taiwan in an even more vulnerable position,” she said.

Trump, too, is a wild card. He spoke to Tsai on the phone last year and approved a $1.4 billion arms sales package, but has also talked of Taiwan as a potential bargaining chip in the broader contest with Beijing. He has veered between buddying up to China’s President Xi Jinping and attacking Beijing over trade. 

The backdrop is a rise in tensions between Taipei and Beijing since the 2016 election of Tsai. Her party sees Taiwan as a de facto sovereign nation, and although she has ruled out any declaration of independence from China, she has declined to endorse the idea that there is “one China.” 

China has responded by restricting the flow of mainland tourists to the island. It has poached two of Taiwan’s few diplomatic allies, put pressure on global corporations to list Taiwan as a province of China on their websites, and managed to exclude it from international bodies coordinating global health policy and civil aviation.

It has also stepped up sorties by fighter jets and bombers around the island, and sent its sole aircraft carrier through the Taiwan Strait, most recently last month. Xi, meanwhile, has dialed up the nationalist rhetoric, warning in a speech to the National People’s Congress last month that any attempt to split China would be met by “the punishment of history.”

Xi also pledged to push for the complete “peaceful reunification of the motherland,” a key part of the Communist Party’s goal of achieving the “great rejuvenation of the Chinese nation” by the centenary of its ascent to power, in 2049. 

But could China try to force the issue before then? 

Five years ago, Xi declared that the problem of the China-Taiwan divide “cannot be passed from generation to generation.” With the removal of term limits on his presidency, experts believe he now sees “reunification” as part of his legacy, preferably peacefully.

“As the modern emperor of the Middle Kingdom, this is very much on his agenda to resolve the Taiwan issue in his lifetime,” said Jason Hsu, a legislator with the opposition Kuomintang. 

Ian Easton, a fellow at the Project 2049 Institute and author of “The Chinese Invasion Threat,” said Taiwan remains in a strong position to repel a potential invasion, partly because of its forbidding island geography. But that conclusion may not stand indefinitely, especially as China’s defense spending rises by 8 percent a year while Taiwan’s essentially stagnates, he said.

“What is the aim of China’s military modernization? Their number one war scenario, their main strategic direction since 1993, is the invasion and occupation of Taiwan,” he said. “The Taiwanese don’t have a sense of crisis; they take peace for granted.”

In June, the American Institute in Taiwan, the de facto embassy there, will move its Taipei office to a new location, with long-standing plans to invite a Cabinet-level official to inaugurate it. 

That wouldn’t be unprecedented: Environmental Protection Agency chief Gina McCarthy visited in 2014. But this time, any such visitor could be viewed — through the prism of the Taiwan Travel Act and amid worsening Sino-U.S. relations — as a potential provocation.

Taiwan’s government wants strong and steady support from Washington, including more visitors, more regular arms sales, firmer backing to prevent its exclusion from international bodies, and ultimately a free-trade agreement with the United States. But no one here wants sudden moves from Washington that could provoke Beijing to lash out.

Neither Trump nor Xi wants conflict over Taiwan — both have more pressing problems to deal with, not least North Korea’s nuclear weapons. But if each leader surrounds himself with yes-men, the risks of miscalculation rise.

“As Xi becomes more of a dictator, no one will challenge him, and it will be very hard for him to get objective opinions on anything,” Easton said. “If one day he asks his generals: ‘Are you ready for the invasion of Taiwan?’ they’re going to say yes. Who would dare to say no?”