In remarks clearly but indirectly aimed at president Donald Trump, Chinese president Xi Jinping blasted the American leader for his "foolish" efforts to reshape other nations such as China.

In a speech delivered at the opening of the ongoing Conference on Dialogue of Asian Civilizations in Beijing on Wednesday, Xi echoed patriotic sentiments on state-run media shouting defiance at Trump and proclaiming China will "fight to the end if the U.S. wants to."

Xi previously said the Chinese people "are united and their determination as strong as a rock to safeguard national unity and territorial integrity, and defend national interests and dignity."

He reiterated this stand at the dialogue.

"Exchanges and mutual learning among civilizations should be reciprocal and equal," said Xi. "They should be diversified and multidirectional, rather than compulsory or coercive. They should not be one-way."

"To think that one's own race and civilization are superior to others, and to insist on transforming or even replacing other civilizations, is foolish in understanding and disastrous in practice."

Xi's speech at the opening ceremonies was closely watched since it was his first public address since the Trump imposed fresh tariffs of 25 percent on Chinese goods last May 15. China then retaliated with its own tariffs on Tuesday.

"Exchanges and mutual learning among civilizations should be reciprocal and equal," said Xi. "They should be diversified and multidirectional, rather than compulsory or coercive. They should not be one-way."

Despite his strong language, Xi also left the door open for compromise.

He noted various civilizations are not destined to clash as long as people are able to appreciate the beauty of all civilizations. He said China will embrace the world with a more open posture and contribute more dynamic civilization achievements to the world in the future.

Foreign guests at the dialogue including Cambodian King Norodom Sihamoni, Greek President Prokopis Pavlopoulos, Singaporean President Halimah Yacob, Sri Lankan President Maithripala Sirisena, Armenian Prime Minister Nikol Pashinyan, and UNESCO Director-General Audrey Azoulay.

Some of these leaders in their speeches stressed the need to respect the differences, uniqueness, and diversity of civilizations. They said the so-called clash of civilizations argument is a huge mistake that will damage or cut off the bridge for civilization exchanges.

The week-long dialogue includes an opening ceremony, panel discussions, an Asian culture carnival and Asian Civilization Week involving more than 110 activities to showcase the diversity and charm of Asian civilizations.