Prime Minister Narendra Modi has taken the right decision to visit Nepal, just weeks after he hosted his Nepalese counterpart, Khadga Prasad Oli, who chose India for his first foreign trip. New Delhi’s traditionally close relationship with Kathmandu is today in need of urgent repair, in part because of the Modi government’s missteps in the past couple of years and because of the election of a China-backed communist coalition in Nepal.

Landlocked Nepal has lurched from one crisis to another for more than two decades. Ever since it embarked on a democratic transition, it has been in severe political flux. It is too early to say if the Oli government will be able to bring political stability. The promise of an early merger of the two main Communist parties that have formed the government has given way to protracted negotiations and public squabbling.

Nepal is a strategic buffer between India and the Chinese-occupied Tibet, and developments there directly impinge on India’s security. India has an open border with Nepal permitting passport-free passage. This open border is becoming the Indian internal security’s Achilles heel.

Oli has long been a divisive figure. As a Communist guerrilla, he spent years in jail in the 1970s and 1980s for waging war against the state. In his first stint as PM from October 2015 to August 2016, Oli stoked tensions with the people in the Terai region (the Madhesis) and with India, deepening Nepal’s ethnic and political fault lines.

Now, in his second stint as PM since February 15, Oli has been talking of a foreign policy that maintains “equidistance” from India and China — in other words, a policy that seeks to balance Nepal’s two neighbouring powers. In reality, Oli — dubbed “Oily Oli” by his critics — can barely disguise his pro-China stance. After all, he is beholden to Beijing for bringing Nepal’s two Communist parties together before the elections and thereby helping him to return to power. He had accused India of manoeuvring his ouster as PM in August 2016.

Still, Oli’s April 6-8 New Delhi visit was intended to buy peace with India, which he recognises has still the capacity to make things difficult for him, in spite of China’s growing role and clout in Nepal. During his visit, he sought to assure New Delhi that he will not allow Nepalese territory to be used against Indian interests. But he will find it difficult to bridge the gap between his words and actions.

Modi has his own compulsions to visit Nepal. The impressive gains of his first visit in August 2014 were squandered by Indian missteps, including waking up belatedly to Nepal’s flawed new Constitution and then backing the Madhesi movement in favour of constitutional changes — an agitation that resulted in a five-month blockade on the cross-border movement of oil and other essential supplies from India to Nepal.

The new Constitution has left the plains people politically weaker through gerrymandered boundaries. The electoral system has been so manipulated as to give the hill people greater political representation than their population size merits.

In Nepal, however, a deep-seated suspicion about India’s intentions surfaces time and again, especially when the country’s internal problems worsen. The blockade whipped up a nationalistic backlash against India, especially because it occurred even before Nepal could recover from a devastating 7.9-magnitude earthquake — its worst natural disaster in more than eight decades. Oli’s government scapegoated India for Nepal’s then political and constitutional crisis, accusing it of imposing an unofficial trade blockade on Nepal.

The Modi government’s lack of a clear strategy on Nepal and its meandering approach made things worse. Having encouraged the Madhesi agitation, India later abandoned the Madhesis. Without Kathmandu meeting the Madhesis’ core demands, India pressured Madhesi leaders to participate in the state and federal elections of November and December 2017. The elections, by bringing to power the communists, strengthened China’s hand.

Now, seeking to cut losses, Modi plans to be in Nepal on May 11 and 12, during which he will also visit Janakpur, in the Terai plains. The visit to Janakpur — where, according to the Ramayana, Lord Rama wed Sita — in intended to signal that his government is still with the Madhesis.

The stark reality for India, however, is that its clout in Nepal has considerably eroded, both because of China’s aggressive inroads and the failure of successive Indian governments to handle that country strategically. It will not be easy for India to recoup its losses.

Oli, for his part, will continue to play the China card against India. For example, just after returning from New Delhi, he sent his foreign minister to pay obeisance in Beijing, where it was announced that China and Nepal would partner in trans-Himalayan transportation projects, including building a railway to Kathmandu.

Over the years, New Delhi has repeatedly conveyed to Kathmandu that China and Pakistan are taking advantage of the open Indo-Nepalese border to engage in activities detrimental to India’s security. For example, Pakistan’s Inter-Services Intelligence used Nepal to stage the December 24, 1999 hijacking of Indian Airlines flight IC-814. Nepal has also become a transit point for the flow of counterfeit Indian currency notes and narcotics to India.

But it will not be easy for India to close the open border with Nepal, given the cross-frontier kinship ties. Moreover, some six million Nepalese work and live in India.

Meanwhile, Nepal’s political flux will also continue to affect India. Since returning to office, Oli has aggressively moved to expand his power, including seeking to make the judiciary subservient to the executive branch and eroding the autonomy of other institutions. His actions rekindle the question: Can democracy and communism go together?

The writer is a geostrategist and the author of nine books, including the award-winning “Water: Asia’s New Battleground”. Views expressed are personal.