President Trump lavished praise on Indian Prime Minister Narendra Modi at the G-20 summit in Japan, turning an expected confrontation over trade into a show of unity at China’s expense.

“We’ve become great friends, and our countries have never been closer,” Trump told Modi prior to their bilateral discussion in Osaka on Friday. “So, it’s been a lot of fun being with you.”

Those comments downplayed the trade disputes percolating between the United States and India. He was more pugnacious on Twitter earlier this week, when he demanded Modi cancel a batch of “unacceptable” tariffs recently imposed on American products. But the president opted for conviviality on the ground, as U.S. partners staged a show of diplomatic unity as an apparent warning to Chinese President Xi Jinping.

“I think we three countries are the foundation of the peace and prosperity of the region,” Japanese Prime Minister Shinzō Abe told reporters alongside Trump and Modi at a separate meeting. “Free and open Indo-Pacific is something that we would like to strive toward, and I’d like to have closer coordination among three countries going forward.”

“Japan, America, and India,” Modi concurred. “Jai, in Hindi, means ‘victory.’”

The display evokes a deepening partnership between the United States, Japan, and India. It would have been unthinkable throughout much of the Cold War, when the U.S. and India had tense relations, a history that Chinese diplomats never fail to recall in their own outreach to New Delhi.

“With the Indians in particular, Chinese messaging has tended to try and create a a wedge between India and the U.S.,” Jeff Smith, a research fellow at the Heritage Foundation’s Asian Studies Center, told the Washington Examiner. “So, they’re clearly a little discomfited by this, but it’s not a new phenomenon from their perspective and it’s one that they think they can manage, in part because they think India won’t move too closely to the U.S. and to Japan.”

Chinese officials have a few causes for optimism on that front, despite the back-slapping at the G-20 summit. Indian officials have been forced to stop purchasing oil from Iran after Trump revoked a waiver in May that allowed the sales in order to tighten U.S. sanctions on Tehran.

That decision came weeks after Trump’s team announced that India would no longer be allowed to benefit from a program known as the Generalized System of Preferences. The move raises the costs of Indian goods sold to the U.S., as the Trump administration looks to gain leverage in a dispute over barriers for American companies that want to do business in the subcontinent.

“India feels that the U.S. has been unnecessarily hard on it, and especially by withdrawing the GSP recently,” a local journalist told Secretary of State Mike Pompeo earlier this week. “You talk tough on trade, you’re sweet on defense and other issues. Where is this coming from?”

Pompeo tried to defuse any gathering anti-Trump sentiment. “I hope the Indian people will come to see that we shouldn’t focus on the differences, these things that cause challenges,” he replied. “[W]hen you resolve these problems, both peoples are far better off. And when we do that together, this region and the world will be better off too.”

Indian Foreign Minister Subrahmanyam Jaishankar took a similar approach, acknowledging the trade disputes while calling on Wednesday for both sides to remain “guided by the big picture of the relationship.”

Trouble is brewing on the security front as well, even though Pompeo has succeeded in hammering out major defense agreements.

India has been planning to purchase advanced Russian S-400 anti-aircraft missile systems, which could provoke U.S. sanctions under a federal law designed to crack down on Russia’s defense industry in retaliation for the 2016 election interference.

“We will do what is in our national interest,” Jaishankar said, referring to India’s dependence on Russian weapons. “We have many relationships and some have history.”

It’s not clear if India is eligible for a waiver from the sanctions, which have been applied to China and are expected to be imposed on Turkey, a NATO ally, if Turkish officials finalize a similar sale for the weapons system.

“Right now, you’ve got two trains on one track screaming towards each other and neither side is looking necessarily at an off-ramp that you can see publicly,” Richard Rossow, an India expert at the Center for Strategic and International Studies, told the Washington Examiner.

“If they buy the systems and suddenly the United States impose sanctions … I suspect that will initiate a pretty lengthy chilly period.”

Those tensions lend significance to the heightened cooperation between Japan and India. Abe, who has cultivated a very warm relationship with Trump, likewise has friendly ties with Modi. The two prime ministers have hosted each other at their hometowns, putting a personal touch on a burgeoning partnership against China.

“Japan seeks more autonomy within the U.S.-Japan alliance. India starts from autonomy, but seeks greater U.S.-India-Japan alliance regarding China,” Satu Limaye, the vice president of the East-West Center, a nonprofit organization founded by Congress, with headquarters in Hawaii and Washington, told the Washington Examiner. “For now, this alignment expands the ability of U.S. allies and partners to work together.”

Abe, as the host of the G-20, isn’t missing any opportunities to confront China with a picture of international solidarity against Beijing’s expansionist policies. The competition could be observed even at dinner the first night of the summer: Abe sat with Trump, Modi, and Australian Prime Minister Scott Morrison. The Japanese leader assigned Xi a seat “directly across” from the foursome, as Smith noted.

And Trump played his part, at his sit-down with Modi and the trilateral meeting with Abe and the Indian leader.

“We’ll continue to get along with India,” he said. “A big factor and a big relationship is that of India, and so we’re going to be discussing many things. All very positive.”