“The sky is the limit in this relationship,” he said, with India now an economic power and the strength of the Arab world declining. “We are just scratching the surface.”

For India, the visit is the culmination of a gradual policy pivot.

P.R. Kumaraswamy, a professor of international affairs at Jawaharlal Nehru University in New Delhi and the author of “India’s Israel Policy,” compared it to a clandestine love affair that has, at last, been brought out into the open.

“You have a relationship, but you are not ready to admit it in public,” Professor Kumaraswamy said. “If I’m going to have an affair with a woman, I’m not going to make her part of all my decision-making. But if you marry a person, it’s the whole package: where you want to live, how you see your life 20 years from today.”

India’s position traces to the last days of the British Raj, when its nationalist leaders saw common cause with the post-colonial Arab world. With independence came a far more practical consideration: The governing Indian National Congress party was desperate to secure the loyalty of India’s large Muslim minority, which was also being wooed by the Muslim League.

New Delhi did not recognize the Jewish state until 1950, two years after its establishment. The militaries of the two countries steadily built ties starting in the 1980s, as India sought suppliers outside the Soviet bloc, but the two governments did not establish full diplomatic relations until 1992, under Prime Minister P.V. Narasimha Rao.

“When the Cold War ended, India had to say, ‘I know there is a new world,’ and the most effective way of doing this is establishing relations with Israel,” Professor Kumaraswamy said. “By changing the relations, he said, ‘I am breaking from the past.’”

For Mr. Modi, this visit serves a similar purpose. Unlike its nemesis, the socialist Congress Party, his Hindu nationalist party has always argued for better relations with Israel. Professor Kumaraswamy said Mr. Modi hoped his visit would allow India to gain access to both civilian and military technology.