Nepal has become the third country in India's immediate neighbourhood to see a violent uprising topple its government in recent years.

Prime Minister KP Sharma Oli resigned after more than 20 people died in clashes with police during anti-government demonstrations triggered by a social media ban.

A nationwide curfew is in place and the army is attempting to bring the situation under control after protesters stormed parliament and set fire to the homes of several politicians.

For many, the scenes in Kathmandu were reminiscent of the turmoil that gripped Bangladesh last year and Sri Lanka in 2022.

Though Bangladesh and Sri Lanka are also India's close neighbours in South Asia, Delhi's relationship with Kathmandu is special because of historic people-to-people, economic, and strategic ties.

Nepal shares a largely open border of more than 1,750km (466 miles) with five Indian states; Uttarakhand, Uttar Pradesh, Sikkim, Bihar, and West Bengal.

Delhi is keenly watching developments across the border, with Indian Prime Minister Narendra Modi swiftly reacting to the unfolding events.

'The violence in Nepal is heart-rending. I am anguished that many young people have lost their lives,' Modi wrote in a post on X on Tuesday.

Stressing that 'stability, peace, and prosperity of Nepal are of utmost importance', he appealed to 'all my brothers and sisters in Nepal to support peace'. Modi also chaired an emergency security meeting with his cabinet colleagues on Tuesday to discuss the situation.

Much like it was caught off-guard by the uprising in Sri Lanka in 2022 that forced the then-president Gotabaya Rajapaksa to flee the country, analysts say India was taken by surprise by the developments in Nepal, with Oli resigning just a week ahead of a planned visit to Delhi.

Any instability in Nepal is a cause of concern for India due to its strategic location.

'The Western Theatre Command of China sits right across Nepal. The route to the Indo-Gangetic plains comes straight through Nepal,' Maj Gen (Retd) Ashok Mehta, an expert on Nepal, told the BBC.

The unrest also has implications for the large Nepalese diaspora in India. An estimated 3.5 million Nepalis live or work in India, with some experts suggesting the actual number could be much higher.

Nepal is predominantly a Hindu-majority country, with close family ties across the border. People can travel between the two nations without a visa or passport. Nepalis also have the right to work in India without restriction under a 1950 treaty. Additionally, 32,000 Gurkha soldiers from Nepal serve in the Indian army under a special agreement.

Given Nepal's strategic location, both India and China are vying for influence, leading to allegations of meddling in Nepal's internal affairs.

Experts say India will have to reach out to the new administration to address differences and engage with disaffected young Nepalis. The crisis in Nepal comes at a challenging time for India, with relations with Pakistan at a low point and Bangladesh relations strained.

Nepal's ongoing political changes will require careful diplomatic navigation by India, as they aspire for stability in a region that has seen increasing turbulence.