Faced with repeated rhetorical broadsides from the U.S. president and the possible scrapping of a decades-old trade agreement governing much of its international commerce, Mexico appears eager to bolster its relationships with key American rivals.

Mexican President Enrique Pena Nieto joined Chinese President Xi Jinping, Russian President Vladimir Putin and Indian Prime Minister Narendra Modi, among other world leaders, at the site of an economic summit that wrapped up Tuesday in southeastern China. The summit coincided with the end Tuesday of a second round of trade discussions between the U.S., Mexico and Canada on retooling the North American Free Trade Agreement – a 1990s-era free trade deal that President Donald Trump has said he feels will "probably" need to be scrapped.

Separate meetings between Pena Nieto and both Putin and Xi – leaders of two countries with which the U.S. has tense international relationships – further enhance the optics of Mexico casting a wide net to potentially offset trade losses that would come from a destroyed NAFTA, while also shoring up diplomatic ties.

"Mexico wants to trade more with the world. Free trade is an essential part of their growth strategy. Of course, if NAFTA collapses, the Mexican economy could take a hit in the short term … risking macroeconomic stability," Dany Bahar, a fellow in the Global Economy and Development Program at The Brookings Institution, said during a podcast Friday. "But in the medium to long term, Mexico has plenty of opportunities to trade with other partners."

Pena Nieto joined leaders from Egypt, Guinea, Tajikistan and Thailand in Xiamen, China, as participants in an emerging markets dialogue that occurred alongside a summit of the BRICS nations: Brazil, Russia, India, China and South Africa. Officials also were expected to discuss a possible "BRICS Plus" expansion plan that would open up the bloc to more countries.

Speaking with Chinese state media recently , Pena Nieto – whose country Trump has insisted will fund his promised border wall and slammed as having taken advantage of the U.S. on cross-border trade – praised the BRICS group for making "important progress" in recent years, "particularly in the area of cooperation and coordination in multilateral forums on economic and political governance."

The Mexican president, who met with Xi on Monday, also said "diversifying" his country's trade portfolio is "one of the pillars of our trade policy." And he insisted his country is "committed to free trade," even as the future of its largest free trade agreement remains uncertain.

The Pena Nieto administration's recent trade pursuits outside North America – from conversations with Brazil and Argentina to Australia and New Zealand – have been viewed at least in part as a safeguarding shift as Trump pivots the U.S. toward more isolationist policies, potentially threatening Mexico's accessibility to what is currently its largest export market.

Neither the Trump administration nor NAFTA's renegotiation were referenced explicitly in public comments by Pena Nieto or many other high-profile world leaders attending the BRICS conference, which began Sunday. But the changing tides in North America still represented an elephant in the room, as Pena Nieto praised the multilateral cooperation Trump has sought to avoid and the type of trade deals Trump has either torpedoed – in the case of the Trans-Pacific Partnership – or threatened to walk away from, in the case of NAFTA.

In prepared comments on Tuesday, Xi similarly highlighted increasing "risk and uncertainty in the world," particularly regarding multilateral trade.

"Multilateral trade negotiations make progress only with great difficulty, and the implementation of the Paris Agreement has met with resistance," the Chinese president said, appearing to reference the Paris climate agreement Trump announced the U.S. would withdraw from earlier this year, according to Reuters. "Some countries have become more inward-looking, and their desire to participate in global development cooperation has decreased."

Like Mexico, Xi and China also have been subject to trade threats from Trump, who has tried to pressure China to rein in North Korea's nuclear ambitions and said in the aftermath of a recent North Korean nuclear test that he was considering completely cutting off trade with all countries that do any business with the Hermit Kingdom. That would include Mexico, Russia and China – North Korea's largest trade partner.

The U.S. is the largest buyer of goods exported from both Mexico and China, so turning off the spigot entirely undoubtedly would endanger both economies in the immediate future. But Mexico and China have the potential to at least partially offset one another's losses over the longer run, particularly as wages in China have climbed while those south of the U.S. border remain relatively subdued.

"A lot of the things Mexico is currently exporting to the U.S., such as machinery, cars and auto parts, are currently being imported by China from places other than Mexico. Thus, there is a lot of space for Mexico to shift most of its exports toward large and growing markets besides the United States," Bahar said.

Pena Nieto's sidebar Tuesday with Putin – whose country was recently targeted by congressionally approved sanctions and engaged in a series of back-and-forth diplomatic restrictions with the U.S. – also marked a meeting of two world leaders seeking to work around the sheer size and weight of the American economy.

The Russian economy isn't nearly as substantial as China's, but tightened Mexico-Russia relations would give Putin a greater trade foothold in North America, and could disrupt what until recently had been relatively unified opposition to Russian aggression in the aftermath of Moscow's annexation of Crimea.

With respect to political goings-on in the U.S., Putin on Tuesday wouldn't comment because he said Trump is "not my bride, and I am not his groom." He did, however, refer to the recent closure of Russian diplomatic facilities in the U.S. as "an obvious violation of property rights" and "boorish." He also said it was "hard to deal with people who confuse Austria and Australia" – an apparent dig at those in U.S. foreign policy circles – and hinted that he could seek legal recourse, according to The New York Times .

"We'll see how efficient the much-praised American judiciary is," Putin said.

Indeed, Mexico appears to have found company in its grievances with the U.S. – and its push this week to get closer to Russia and China appears to be aimed at strengthening trade and commerce bridges as the U.S. threatens to burn those of its own. A Russian government release on the meeting between Pena Nieto and Putin stated the two presidents discussed issues of trade as well as "cooperating on foreign policy matters, including within various international organisations and on pressing regional issues."