India's Prime Minister Narendra Modi concluded a three-day state visit to China, more or less fulfilling his promise of visiting the neighbouring Asian powerhouse within his first year in office. The trip served as a quid pro quo for Chinese leader Xi Jinping's late-2014 visit to India, which revealed tremendous personal chemistry between the two leaders and paved the way for $20bn in Chinese investment pledges as well as 12 different agreements for cooperation across various fields.

Prior to his rise to the helm of India's political system, China always loomed large in Modi's strategic calculations. For him, China represented an indispensable economic partner for India. As the former chief of the Indian state of Gujarat, Modi was a regular visitor to China, constantly courting greater manufacturing and infrastructure investment for his constituency.

And partly thanks to economic lessons from and robust economic ties with China, Modi's Gujarat emerged as an economic powerhouse in India, achieving a whopping 10 percent average annual Gross Domestic Product growth from 2001 to 2012.

Inside Story - Is an India-China arms race brewing?

When he was ostracised by the West, due to allegations that Modi was complicit in the early-2000s sectarian violence in Gujarat, it was China that consistently embraced him with utmost warmth and cordiality. Quite naturally, this left a largely positive impression on the Indian leader.

Economic stakes

Yet, Modi is also a nationalist, who has not only vowed to defend India's territorial integrity against Chinese designs in the state of Arunachal Pradesh in the Himalayas, but has also increasingly cast away India's long history of non-alignment in favour of closer strategic ties with the United States and Japan. And this may explain why Modi chose Tokyo and Washington as his first major foreign trips before going to Beijing this year.

Just like Xi's festive visit to India last year, Modi also put some personal touches to his diplomatic charm offensive in China, including a widely covered "selfie" picture with his Chinese counterpart, Li Keqiang.

Xi first hosted Modi in his home province of Shaanxi, reciprocating Modi's decision to host Xi in his home state of Gujarat previously. The state-run China Daily reported that Xi requested for "highest-level reception" for his Indian guest, underscoring Beijing's intent on projecting a special spirit of comradery between the two Asian giants. Greeted with scores of flower-bearing children and lion dancers upon his arrival in China, Modi expressed how he was "very glad to see the enthusiasm among the people of China" on his Twitter account.

Just like Xi's festive visit to India last year, Modi also put some personal touches to his diplomatic charm offensive in China, including a widely covered 'selfie' picture with his Chinese counterpart, Li Keqiang.

The Indian leader was intent on securing maximum economic benefits from the trip. For long, India has complained about bilateral trade imbalances, which have been exacerbated by Chinese restrictions on imports of value-added Indian goods and services such as pharmaceuticals and IT expertise. India suffers a massive trade deficit with China, which increased by about 34 percent in 2014-15 and reached as high as $48bn.

Modi sought China to leverage its vast financial resources to help India address its $1 trillion infrastructure spending needs. Sitting on $4 trillion in exchange reserves, and commanding one of the world's most capable state-owned corporations, China has the wherewithal and the interest in pursuing more tangible investment options such as infrastructure development across Asia.

The creation of the Asian Infrastructure Investment Bank, which includes India among its key founding members, was largely motivated by China's interest in playing a more decisive role in revamping the region's economic landscape. The two sides signed 21 trade and investment deals worth up to $22bn during Modi's visit. So Modi isn't going home empty-handed, though India surely expects even greater economic commitment from China.

Tricky trip

The elephant in the room, however, is the Sino-Indian 4,000km-long disputed border in the Himalayas, the Line of Actual Control (LAC), which sparked a brief and bitter war back in 1962 - and has since embittered bilateral relations.

During his trip, Modi bluntly remindedhis counterpart about "the need for China to reconsider its approach" on their territorial disputes and emphasised how they "should take a strategic and long-term view of our relations". For optimists, however, there are two reasons to look forward to a potential thaw in bilateral territorial disputes.

First, Modi's strong nationalist credentials and extensive control over India's foreign policy apparatus provide him with significant political capital to make necessary compromises for a lasting de-escalation in Sino-Indian border disputes. Modi enjoys unparalleled popularity at home, and hardly anyone can accuse the charismatic Indian leader of lacking patriotism and foreign policy vigour.

Second, China's festering maritime disputes with its neighbours along the East and South China Seas, which has drawn US naval muscle in, may encourage Beijing to dial down border tensions with India in order to avoid full encirclement.

Modi takes a selfie along with Chinese Premier Li Keqiang in Beijing [Reuters]

The short-term prospects for a qualitative improvement in Sino-Indian border disputes, however, are dim. While India has pushed ahead with fortifying its position in disputed borders, China has also shown little appetite for compromise.

Last year, Xi's visit to India coincided with a dangerous escalation along the LAC, as People's Liberation Army forces reasserted China's claim in the area. It is highly doubtful that Modi and Xi will agree on any workable mechanism for managing their border disputes in the foreseeable future.

Beijing has also been irked by Modi's decision to move closer to Washington and Tokyo, with India more explicitly and consistently criticising China's maritime assertiveness in South China Sea in recent years.

Overall, Modi's trip to China paved the way for sufficient diplomatic rapport and economic interdependence to avoid a full estrangement between the two giant neighbours. But there was just so much that smiles and a single state visit could do.

Richard Javad Heydarian is a specialist in Asian geopolitical/economic affairs and author of "How Capitalism Failed the Arab World: The Economic Roots and Precarious Future of the Middle East Uprisings."

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.