Panama opened its first embassy in China on Thursday five months after cutting ties with Taiwan, which has seen its allies dwindle against the mainland’s growing influence.

In a speech heralding the embassy’s “historic” establishment, Panamanian President Juan Carlos Varela said his “commitment to the One China principle” was made with the benefits for Panamanian people in mind — alluding to Beijing’s position that Taiwan is a part of Chinese territory and will be brought back into the fold at some point.

Mainland China and Taiwan split after a civil war in 1949 and while Taiwan sees itself as a sovereign nation, it has never formally declared independence.

There now remain only 20 nations worldwide with official ties to Taiwan, as others have chosen to form diplomatic relations with China instead.

“This is the correct decision,” Chinese foreign minister Wang Yi said at the embassy’s opening ceremony, noting that the Panamanian president had expressed a wish to become “the best of friends” with China during a visit to the country one decade ago.

Photo: Panama gov’t.

Varela said he looked forward to the two countries participating in exchanges related to culture, trade and tourism.

After the United States, China is the second-most frequent user of the Panama Canal.

China and Panama will sign some 20 cooperative agreements after Chinese President Xi Jinping meets with Varela Friday.

“From today onwards, Panama’s national flag will fly in the heart of China, its capital, Beijing,” Varela said.

Photo: Panama gov’t.

At the end of the ceremony, Varela and Wang pulled down a curtain to reveal the embassy lettering and clinked glasses of champagne.

AFP is a global news agency delivering fast, in-depth coverage of the events shaping our world from wars and conflicts to politics, sports, entertainment and the latest breakthroughs in health, science and technology.