BEIJING/TAIPEI (Reuters) - China warned Taiwan on Friday it would only get burnt if it sought to rely on foreigners, adding to warnings from state media the country could go to war over Taiwan if the United States passes into law a bill promoting closer U.S. ties.

FILE PHOTO - A demonstrator holds flags of Taiwan and the United States in support of Taiwanese President Tsai Ing-wen during an stop-over after her visit to Latin America in Burlingame, California, U.S., January 14, 2017. REUTERS/Stephen Lam

The legislation, which only needs President Donald Trump’s signature to become law, says it should be U.S. policy to allow officials at all levels to travel to Taiwan to meet their Taiwanese counterparts, permit high-level Taiwanese officials to enter the United States “under respectful conditions” and meet with U.S. officials.

Beijing considers democratic Taiwan to be a wayward province and integral part of “one China”, ineligible for state-to-state relations, and has never renounced the use of force to bring the island under its control.

China’s Taiwan Affairs Office said the bill was a serious contravention of the “one China” principle.

“We also sternly warn Taiwan: do not rely on foreigners to build yourselves up, or it will only draw the fire upon you,” it said in a short statement.

In a strongly-worded editorial, the official China Daily said if the bill becomes law it will only encourage Taiwan President Tsai Ing-wen to further assert the island’s sovereignty.

“Which, if she persisted, would lead to the inevitable consequence of triggering the Anti-Secession Law that allows Beijing to use force to prevent the island from seceding,” the paper said, referring to a Chinese law passed in 2005.

“Since the U.S. is bound by domestic law to act on behalf of the island in that instance, it would only give substance to the observation that the descent into hell is easy.”

China’s hostility towards Taiwan has risen since the election to president of Tsai from the pro-independence Democratic Progressive Party in 2016.

China suspects Tsai wants to push for formal independence, crossing a red line for Communist Party leaders in Beijing, though Taiwan’s leader has said she wants to maintain the status quo and is committed to ensuring peace.

Taiwan has welcomed the U.S. legislation.

Speaking to reporters in Taipei on Friday, Premier William Lai said the United States was a “solid ally” of Taiwan’s and expressed his deep thanks for the legislation.

“We wholeheartedly anticipate that this law can in the future further raise the substantive relationship between Taiwan and the United States,” Lai said.

In a second editorial, the widely-read state-run Global Times tabloid said China could “make targeted measures against pro-independence forces in Taiwan”.

“Militarily, the strength of the People’s Liberation Army has fundamentally changed the military and political situation across the Straits,” it said, talking about the narrow waterway that separates Taiwan from its giant neighbor.

“Thanks to its rapid growth, the Chinese mainland is now granted unparalleled strategic initiative across the Taiwan Straits.”

China has dramatically upped its military presence around Taiwan. China’s air force has carried out 16 rounds of exercises close to Taiwan in the last year or so, said Taiwan’s defense ministry in late December, warning that China’s military threat was growing by the day.

The United States has no formal ties with Taiwan but is bound by law to help it defend itself and is the island’s main source of arms. China regularly says Taiwan is the most sensitive issue in its ties with Washington.