Indian Prime Minister Narendra Modi capped a historic three-day visit to Israel on Thursday with a barefoot stroll along the Mediterranean shore with Israeli counterpart Benjamin Netanyahu.

The two leaders' exuberance for warming bilateral ties has taken the form of bear hugs, greetings on social media and pledges for increased trade and cooperation.

Modi and Netanyahu on Thursday paid their respects to Indian soldiers killed fighting with the British Army during World War I before taking a spin on the beach in an Israeli-designed mobile desalination buggy.

The two sipped water produced by the machine, served in wine glasses, before Modi hitched up his pants and waded ankle-deep into the surf. Netanyahu did not roll up his slacks, which got soaked.

Israeli agriculture and water technologies have been a major draw for Indian investment and the subject of several deals signed during Modi's visit.

"India admires the success of people of Israel in overcoming adversity to advance, innovate and flourish against all odds," Modi said Wednesday at a joint press conference highlighting water and agricultural technology.

Netanyahu touted Israel's ties with the world's most populous democracy as a "marriage made in heaven," while Modi proclaimed that their goal was "to build a relationship that reflects our shared priorities and draws on enduring bonds between our peoples."

Though India kept a frosty distance from Israel during the Cold War, aligning itself with the Soviets and favoring the Palestinian cause, the past two decades have seen New Delhi forge ever closer diplomatic and trade relations with the Jewish state.

Bilateral trade has skyrocketed from $200 million in 1992, when India and Israel established diplomatic ties, to $4.16 billion in 2016, according to the Indian Embassy in Tel Aviv. Even so, that figure remains far below Israel's nearly $40 billion in annual bilateral trade with its largest partners, the US and EU.

Both countries appear set on reducing that gap. Billions of dollars in Israeli arms sales to New Delhi have formed the bedrock of diplomatic detente.

Israel is India's third-largest supplier of weapons after the United States and Russia. Earlier this year, Israel's state-owned Israel Aerospace Industries announced over $2 billion in air and missile-defense contracts with India.

Modi and Netanyahu, both leaders of nationalist parties, said they discussed greater security cooperation, encompassing counterterrorism and cybersecurity. Amid a handful of high-level trade agreements, three Israeli defense firms announced a new deal to provide India with top-of-the-line combat drones.

Modi's visit, the first by an Indian prime minister, marks 25 years of diplomatic relations. He visited the Yad Vashem Holocaust memorial, embraced a boy whose parents were killed in a 2008 massacre in Mumbai carried out by Islamic militants, and addressed an ecstatic crowd of Indian Jews in Tel Aviv.

Modi did not meet with any Palestinian officials during his visit. Indian and Palestinian officials say there was no snub, noting that Palestinian President Mahmoud Abbas visited Modi in India in May.