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.”