Mr. Trump drew some of the day’s loudest cheers when he mentioned India’s rival and neighbor, Pakistan, saying that he was working with that country “to crack down on the terrorist organizations" that operate along its border with India, and which New Delhi sees as a mortal threat”Every nation has the right to secure and controlled borders. The United States and India are committed to working together to stop terrorists and to fight their ideology,” Mr. Trump said.

Mr. Trump, who tweeted good wishes to India in Hindi before and after his arrival, was joined on his flight there by his wife Melania, his daughter Ivanka and her husband, Jared Kushner. Before arriving at the stadium, Mr. Trump removed his shoes and donned a traditional scarf for a visit to an ashram where the former Indian leader Mohandas K. Gandhi once lived.

Ahmedabad is the biggest city and the main business hub in Gujarat, Mr. Modi’s home and political base. Many of the most influential Indian-Americans are also originally from Gujarat, and a growing source of political and financial support for Mr. Trump as he heads toward re-election. Mr. Trump said on Monday that four million Indian-Americans live in the United States, including “titans of business” and “pioneers of science.”

Gujarat is also the place where Mr. Modi’s critics say that he, as chief minister of the state, played an unforgivable role during a wave of sectarian violence in 2002 that left more than 1,000 people dead — almost 800 of whom were Muslims killed by Hindu mobs.

Mr. Modi has been widely accused of at least tacitly supporting the violence. Much of the killing was done by members of his political party and other Hindu nationalist groups. Many witnesses said police officers did not intervene and in many cases joined in the killing.