Mr. Modi returned the favor, praising Mr. Trumpâs âvast and successfulâ business experience, which he predicted would galvanize relations between the United States and India. He also invited Mr. Trumpâs daughter Ivanka to a conference of entrepreneurs in India.
Yet the mutual admiration masked a more complicated dynamic between India and the United States. While ties between the two have grown steadily closer over the last two decades, India faces new uncertainties with Mr. Trump, who has shown less interest than his predecessors in maintaining a web of trade and security alliances in Asia.
India, like other countries in the region, has watched Mr. Trumpâs cultivation of Mr. Xi with concern. His trade and immigration policies, particularly limits on visas commonly used by technology workers from India, have added to the jitters, as did his decision to pull out of the Paris climate accord.
âIndia would like to continue to deepen its friendship, but Trump can only be an object of concern, even if he tweets lovely compliments after dinner,â said Ashutosh Varshney, director of the Center for Contemporary South Asia at Brown University. âIndia might get a good deal, or not a bad deal, or a bad deal, or no deal. Who can say?â
For now, the United States and India are finding common cause in pushing back against Chinaâs maritime ambitions. Before Mr. Modiâs visit, the Trump administration approved the sale of 22 surveillance drones to India, which New Delhi can use to eavesdrop on Chinese naval movements in the Indian Ocean. Mr. Trump also spoke about a huge joint naval exercise in the Indian Ocean that will involve Japanese, Indian and American warships.
India has its own deep-rooted suspicions of China. Mr. Xiâs marquee development project â known as One Belt, One Road â seeks to knit together China, South and Central Asia, and Europe through a vast array of ports, roads and railways, mostly funded by China. India views the project as a threat to its historically dominant position in South Asia.
The sale of the so-called Guardian drones builds on years of deepening cooperation between the United States and India on maritime security, as India searched for ways to track Chinese submarines entering the Indian Ocean.
Though India is traditionally wary of military alliances, the two countries have explored ways to create a naval network that would balance Chinaâs maritime expansion. Among the proposals are joint naval patrols in the South China Sea, an idea India has so far rejected.
The drones, which have never before been sold to a non-NATO country, could be especially valuable if they are flown over the Andaman and Nicobar Islands, giving India control of a so-called choke point that is one of Chinaâs greatest marine vulnerabilities.
They could be used with Indiaâs fleet of Poseidon surveillance aircraft, which it acquired from the United States beginning in 2013, said David Brewster, a visiting fellow at the National Security College of Australian National University. The Poseidon âsub-huntersâ can also be staged from the Andaman and Nicobar island chain.
The announcement of the sale was followed closely by Chinese news organizations. China Central Television declared, âThe Indian Navy wants to use these drones to put the whole Indian Ocean under its surveillance.â
Mr. Modi and Mr. Trump have much in common, including a history of anti-Muslim rhetoric, a nationalist focus on homegrown manufacturing, a fraught relationship with the news media, and electoral campaigns that benefited from the proliferation of fake news.
In Mr. Modiâs case, supporters of his party circulated fake videos in 2013 of two Hindus being lynched by a Muslim mob. The videos led to rioting that killed 44 people, displaced 42,000 others and split a historical voting alliance between lower-caste Hindus and Muslims. That helped give Mr. Modi a substantial majority in the lower house of Parliament.
Stephen K. Bannon, Mr. Trumpâs chief strategist, hailed Mr. Modiâs victory in 2014 as part of a global revolt against uncaring elites. He has told colleagues he views Mr. Modi and Mr. Trump as symbolizing the same nationalist passions in the worldâs two largest democracies.
Yet they are also very different: Mr. Modi is a deeply religious ascetic who often fasts and points to his lack of family as proof of his commitment to India and resistance to corruption. Mr. Trump, meanwhile, has been widely criticized for his treatment of women and his extravagant lifestyle, and has celebrated his childrenâs business dealings even amid accusations that they are using his office for personal enrichment.
âTrump is not going to want to improve ties with India because of the importance of the international liberal order or to invest in an architecture of Asian alliances, as the last two administrations did,â said Ashley J. Tellis, a senior fellow at the Carnegie Endowment for International Peace. âSo the Indians want the two men to build a personal rapport so that Trump invests in India because he thinks Modi is a great guy. Thatâs the best you can get.â
With little chance of any grand bargains between the countries, both sides are mainly hoping the two leaders get along. Mr. Trump and his wife, Melania, played host to Mr. Modi at a dinner after their appearance together in the Rose Garden. At the end of their remarks, Mr. Modi dispensed with the usual energetic handshake and rather awkwardly hugged Mr. Trump.
âWhether two nationalists will actually hit it off is harder to say,â said Daniel S. Markey, an expert on India at the Johns Hopkins School of Advanced International Studies. âMy guess is they will gamely play along for the cameras, and then go back to their respective sides and complain that the other guy was very strange and hard to understand.â