China warned Washington not to "play with fire" on Wednesday as a US delegation wrapped up a historic trip to the self-ruled island of Taiwan.
Beijing has been infuriated by the highest-profile visit in decades to Taiwan, which it sees as part of its territory, as US-China relations plunge to a record low over a range of issues from trade to military and the coronavirus pandemic.
Health chief Alex Azar finished a three-day visit to Taiwan, during which he criticised China's handling of the pandemic and visited the shrine of a former Taiwan president hated by the Communist Party leadership.
Beijing slammed the visit Wednesday and said it "firmly opposes official exchanges between the US and Taiwan under any pretext".
"On issues involving China's core interests, some people in the US must not harbour illusions, those who play with fire will get burned," said foreign ministry spokesman Zhao Lijian at a regular press briefing.
"I would also like to remind the Taiwan authorities not to be... subservient to others, to rely on the support of foreigners, and to be bent on pursuing independence, which is a dead end," Zhao said.
Beijing insists that Taiwan -- which has been self-ruled since 1949 -- is part of "one China" and has vowed to react with force if it ever formally declares independence.
On the last day of the trip, Azar visited a shrine to Taiwan's late president Lee Teng-hui Wednesday, praising his role in steering the island's transition to democracy.
The US cabinet member wrote a message of condolence for Lee, who died last month aged 97.
"President Lee's democratic legacy will forever propel the U.S.-Taiwan relationship forward," Azar wrote.
Lee was a towering figure in Taiwan's recent history.
He defied China by pushing for the island to be recognised as a sovereign nation and earned the nickname "Mr Democracy" for the part he played in its transition from authoritarian rule.
Beijing, which claims Taiwan as its own territory, loathed Lee. When news emerged of his death, Chinese state media called him "the godfather of Taiwan secessionism".
Both Washington and Taipei portrayed Azar's trip as an opportunity to learn from the success of Taiwan's battle against the coronavirus.
The island has fewer than 500 infections and just seven deaths, compared with more than 160,000 fatalities in the United States.
But the visit has also been an opportunity to ruffle Beijing's feathers at a time when US President Donald Trump is taking an increasingly hard line against China as he seeks re-election in November.
- 'Our friend and partner' -
"We will continue to support Taiwan as our friend and our partner across security, economic and healthcare issues," Azar told reporters after a visit to a mask factory on Wednesday, shortly before flying back the the States.
China takes umbrage at any formal recognition of Taiwan.
It called for Azar's trip to be cancelled and Taiwan accused Beijing of sending fighter jets over a de facto border on Monday, the day the US health chief met President Tsai Ing-wen.
During his visit Azar has repeatedly contrasted Taiwan's open, democratic system with China's authoritarian leadership.
In a speech on Tuesday he suggested the coronavirus might have been stopped sooner had it emerged in a more transparent and democratic place, such as Taiwan, rather than China.
He also hit out at Beijing for keeping Taiwan locked out of the World Health Organization.
China has taken an increasingly hostile approach towards Taiwan since Tsai took office in 2016.
Despite the pressure campaign she won a second term earlier this year with a landslide.