BEIJING/TAIPEI (Reuters) - A threat by a senior Chinese diplomat to invade Taiwan the instant any U.S. warship visits the self-ruled island has sparked a war of words, with Taipei accusing Beijing of failing to understand what democracy means.

China considers Taiwan to be a wayward province and has never renounced the use of force to bring it under its control. The United States has no formal ties with Taiwan but is bound by law to help it defend itself and is its main source of arms.

Beijing regularly calls Taiwan the most sensitive and important issue between it and the United States. In September, the U.S. Congress passed the National Defense Authorization Act for the 2018 fiscal year, which authorizes mutual visits by navy vessels between Taiwan and the United States.

Diplomat Li Kexin said at a Chinese embassy event in Washington on Friday he had told U.S. officials that China would activate its Anti-Secession Law, which allows it to use force on Taiwan if deemed necessary to prevent the island from seceding, if the United States sent navy ships to Taiwan.

"The day that a U.S. Navy vessel arrives in Kaohsiung is the day that our People's Liberation Army unifies Taiwan with military force," Chinese media quoted Li as saying at the weekend, referring to Taiwan's main port.

Taiwan's Foreign Ministry said late on Saturday that, while Chinese officials seemed to want to try and win over hearts and minds in Taiwan, they also had been repeatedly using threats that hurt the feelings of Taiwan's people.

"These methods show a lack of knowledge about the real meaning of the democratic system and how a democratic society works," the ministry said.

Influential Chinese tabloid the Global Times, published by the ruling Communist Party's official People's Daily, said on Monday China would never back down over Taiwan.

"The Chinese mainland has never given up the option of Taiwan reunification by force, which is clear to people across the Taiwan Strait," it said in an editorial.

"Li's words have sent a warning to Taiwan and drew a clear red line. If Taiwan attempts to hold an independence referendum or other activities in pursuit of de jure 'Taiwan independence', the PLA will undoubtedly take action," it said.