Shanghai cut ties with sister-city Prague Tuesday after the Czech capital announced a twinning agreement with Taiwan's capital Taipei.

The decision comes amid an ongoing dispute between Prague's city government and China that has soured Czech-Chinese relations despite a campaign by president Milan Zeman for closer ties with Beijing.

Beijing views Taiwan as part of its territory under what its one-China policy, and has vowed to retake the island one day -- by force if necessary.

Prague mayor Zdenek Hrib, of the anti-establishment Pirate Party and in charge of the city since November 2018, cancelled another twinning agreement with Beijing in October.

In a newspaper commentary published Sunday, Hrib said China was a "risky and unreliable partner", before signing the deal with his Taipei counterpart on Monday.

Shanghai's move comes after the landslide weekend re-election of Taiwan President Tsai Ing-wen, which Beijing sees as an affront to its claims over the self-ruled island.

Prague has "repeatedly made erroneous actions on Taiwan and other major issues involving China's core interests,grossly interfered in China's internal affairs, and openly challenged the one-China principle", Shanghai's city government said in a statement Tuesday.

"We urge Prague's municipal authorities to recognize their mistakes promptly," it added.

Over the last four years the Chinese government has ramped up economic, military and diplomatic pressure on Taiwan, hoping it would scare voters into supporting Tsai's opposition.

But the strong-arm tactics backfired and voters flocked to Tsai's Democratic Progressive Party, fuelled in part by China's hardline response to months of huge and often violent pro-democracy protests in Hong Kong.

Taiwan has seen its circle of friends shrink in recent years as former diplomatic allies switched recognition to an increasingly powerful Beijing.

Hrib said in his commentary in Welt am Sonntag newspaper that he had backed out of the Beijing agreement because he could not sign an agreement that forced Prague to "speak out against the independence of Tibet and Taiwan".

Hrib also accused the Czech government of "neglecting" ideals of the peaceful 1989 Velvet Revolution that ended four decades of communist rule in the Czech Republic.

"As mayor I am working to fulfil my campaign promise to return to a course of respect for democracy and human rights," he wrote.