(CNN) The Czech capital of Prague has waded into China-Taiwan relations, partnering up with Taipei in a geopolitical love triangle that has left Shanghai feeling spurned.

Prague signed a sister city agreement with Taipei, the capital of Taiwan, on Monday -- an agreement that deepened and reinforced their relationship by pledging cooperation in areas including tourism and education.

Sister city agreements formalize relationships between cities, and often bring mutual benefits like special trade or educational exchanges.

Prague Mayor Zdenek Hrib and Taipei Mayor Ko Wen-je after signing the sister city agreement in Prague on January 13, 2020.

The Prague-Taipei agreement was a snub to China, which considers the self-governing island of Taiwan as part of its territory and comes down hard on any suggestions to the contrary.

China's response was swift and furious. On Tuesday, Shanghai -- which was also a sister city with Prague -- cut all ties and suspended official contact, according to a strongly-worded statement from the city government's foreign affairs department.

Prague has "grossly interfered in China's internal affairs, and openly challenged the One China principle," said the statement, referring to China's stance that Taiwan is part of China. "The Shanghai Municipal Government and citizens strongly condemn and solemnly protest!"

How the Prague-China relationship soured

Prague's move is just the latest in a series of steps it has taken recently to move away from China.

Prague also used to be sister cities with the Chinese capital Beijing -- but ended that relationship in October 2019 over a disagreement about Taiwan. In the sister city agreement, Beijing had included a requirement to follow the "One China" principle -- which Prague city councilors overwhelmingly voted against.

"In my view, this means we clearly can't talk about a partnership," Hrib said.

Prague was also disgruntled with Beijing for a second, economic reason -- China had pledged investments that ultimately never came, the mayor said.

In a news release announcing the new Taipei agreement on Monday, Prague officials drew a direct comparison to Beijing and touched on both points of disagreement.

"I believe that cooperation (with Taipei) will be beneficial and will not be burdened with political clauses, as was the case with the treaty with Beijing, which was terminated," Jiri Pospisil, a Czech member of the European Parliament, said in the news release. "Taiwan is a several times larger investor in the Czech Republic than the People's Republic of China, and on top of that it also respects the principles of freedom and democracy."

The mayors of Prague and Taipei walk through Prague's Old Town Square on January 13, 2020.

Mayor Hrib also praised Taiwan's "respect for fundamental human rights and cultural freedoms" in the news release, though he didn't explicitly mention China.

Czech lawmaker Jan Cizinsky was less subtle, however, adding that "sister contracts should never be subject to extortion or threats."

The brief statement from Shanghai didn't respond to any of these accusations -- but it urged the Prague government to "recognize mistakes ... and return to the one China principle."

Beijing remains sister cities with many other major European cities like Budapest, Paris, Amsterdam, and London. Shanghai's sister cities include Bulgarian capital Sofia and the US city of San Francisco.

What is the China-Taiwan conflict?

Prague's move is unusual in that it's one of the few places that has severed a diplomatic relationship with China in favor of one with Taiwan. It also comes amid a growing political debate in the Czech Republic over the country's relationship with China.

China's communist leadership refuses to maintain diplomatic ties with any country that recognizes Taiwan, a democratic island of about 23 million people.

Taiwan and mainland China have been separately governed since the end of a bloody civil war in 1949. Since then, Beijing and Taipei have competed to gain economic opportunities and diplomatic support from governments around the world.

Taiwan's government lost its recognition at the United Nations to the mainland government in 1971. Taiwan now only has 15 diplomatic allies remaining , mostly small nations in the Caribbean and the Pacific, and the Vatican.

In the past two years alone, Kiribati, the Solomon Islands, El Salvador, Burkina Faso and the Dominican Republic all announced they would no longer recognize Taipei , switching diplomatic allegiances to Beijing.

China has also pressured global companies to fall in line with its "One China" policy -- in 2018, US airlines like Delta, American Airlines, and United gave in to China's demands in how they refer to Taiwan on their websites.

China has long pushed for Taiwan's unification with the mainland -- but that is looking less likely than ever.

Just last week, Taiwan reelected President Tsai Ing-wen from the ruling pro-independence leaning Democratic Progressive Party in a landslide, beating out a candidate who was closer to Beijing.

The campaign had been dominated by fears of Chinese encroachment on Taiwanese sovereignty, with many voters alarmed by ongoing unrest in Hong Kong -- once seen as a model for some in China for a potential future takeover of Taiwan.

"The results of this election carry an added significance because they have shown that when our sovereignty and democracy are threatened, the Taiwanese people will shout our determination even more loudly back," Tsai said after her victory.