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 due to historic 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.

Any instability in the country is a cause of concern for India because of Nepal's 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 told BBC.

The unrest also has implications for the large Nepalese diaspora in India, estimated at 3.5 million, with many having close family ties across the border.

The two nations have high levels of interaction facilitated by border openness, allowing Nepalis to travel and work in India without restrictions.

Nepal is also home to important Hindu religious sites, like the Muktinath temple, which attracts numerous Indian pilgrims annually.

While a fragile calm has returned to Kathmandu, experts warn that India must tread carefully amidst widespread anger against the ruling political parties.

The uncertainty around the shape of the new government expands India's need for careful diplomacy.

Given the strategic competition between India and China in Nepal, it's crucial for India to deepen its engagement with the new administration and the youth frustrated with their political leadership.

In light of the current crisis alongside other regional tensions, the task at hand for India’s diplomacy becomes even more delicate as it seems to have diverted its focus from neighbors amid rising great power ambitions.