Chinese President Xi Jinping was in Nepal over the weekend for a two-day state visit — the first by a Chinese leader to the Himalayan country in 23 years.

Key points: India and China are competing for dominance in Nepal

India and China are competing for dominance in Nepal A rail link could potentially reduce Kathmandu's reliance on New Delhi

A rail link could potentially reduce Kathmandu's reliance on New Delhi Closer ties with China could threaten safety of Tibetan exiles in Nepal

Nepalese officials had prepared a wish list of 11 projects for Mr Xi, who arrived fresh from meeting Indian Prime Minister Narendra Modi.

Nepal had hoped for an infrastructure boost involving highways to the Chinese border and a railway link.

They weren't disappointed.

Nepal's ruling Communist Party is the third largest in Asia. ( AP: Bikash Dware via The Rising Nepal )

The two sides signed 20 deals across a range of areas, including health, agriculture and tourism.

Front and centre was an agreement to conduct a feasibility study for an ambitious Chinese-built railway through the Himalaya mountains.

"They're going to build a railway through the third-largest ice pack in the world that's the source of 10 rivers," Himalaya historian Dr Ruth Gamble told the ABC.

"What does this mean for water [supplies] from Pakistan to Beijing?"

Why is China interested in Nepal now?

Map Interactive map showing landlocked Nepal between giants India and China.

Nepal is sandwiched between regional powers India and China.

"The lowest parts of Nepal have a lot in common with India. The highest parts of Nepal are basically Tibetan," Dr Gamble told the ABC.

"The middle band, where Kathmandu and the bulk of the population is, have basically been at war with each other for decades."

"China backed the Maoists there. What you're seeing is kind of a fruition of that."

The last Chinese president to visit Nepal was Jiang Zemin in 1996, although senior officials have visited the country in the interim.

According to former Nepalese diplomat Tanka Prasad Karki, China was waiting for a "strong government in Kathmandu, as the last few decades were marked by a Maoist war, frequent changes of government and political instability."

While it has traditionally relied upon India, Nepal signed onto Beijing's Belt and Road initiative in 2017.

It has been suggested that the Belt and Road initiative fundamentally aims to reshape global trade, with the goal of putting China at the centre.

"China and Nepal are bound by mountains and rivers, and stay as close as lips and teeth," Mr Xi declared over the weekend, as quoted by official news agency Xinhua.

"We will help Nepal realise its dream of becoming a land-linked country from a landlocked one."

The proposed cross-border railway would span 70 kilometres, connecting Kerang in Tibet with Nepal's capital city of Kathmandu.

The proposed Tibet-Kathmandu railway will be an engineering feat. ( ABC News: Graphic by Jarrod Fankhauser )

The Chinese Communist Party also sees ideological allies in Kathmandu. The ruling Nepal Communist Party, while democratically elected, is the third-largest communist party in Asia.

"The dynamics have shifted after the Maoists assumed the dominant political position in Nepal," Raghbendra Jha, director of the Australia South Asia Research Centre, told the ABC.

"They are quite sympathetic to China and the Chinese view of the world."

Why does Nepal need outside assistance?

Mr Xi's visit to Nepal was the first by a Chinese president in more than two decades. ( AP: Bikash Karki )

Nepal is one of the poorest countries in Asia, with a quarter of its 30 million-strong population living on less than 50 cents a day.

Its landlocked, mountainous geography might attract adventure tourism but poses major barriers for economic development.

Some eight in 10 Nepalese live in rural areas, reliant upon subsistence agriculture to survive.

Nepal's mountainous geography makes building infrastructure difficult. ( Pixabay )

"The internal resources are insufficient in Nepal," Kathmandu-based political analysts Atul K Thakur and Kamal Dev Bhattarai wrote earlier this year.

"The country needs huge foreign investment to meet its domestic needs."

Nearly two-thirds of all of Nepal's trade is with India, which also supplies all of its fuel.

"Nepal and India have been closely aligned for a very long time. It is not just economic relations, but very deep rooted cultural relations," Professor Jha said.

"From an economic point of view, a huge portion of Nepalese GDP comes from remittances. The overwhelming bulk of the remittances come from Nepalese workers in India."

The cross-border railway could bring Nepal into Beijing's economic orbit.

What might the economic impact of the rail link be for the Nepalese people? "Impoverished people don't tend to benefit from infrastructure projects," Dr Gamble added.

"It's usually governments and business."

What does India think about the influence of China?

Nepal has suffered a number of disasters — natural and political — in recent years, which have challenged its historical reliance on India.

A devastating earthquake struck Nepal in 2015, killing 9,000 people, injuring 22,000 and displacing many more.

In the months after the earthquake, rather than turning all its attention to reconstruction, the Nepalese Government's biggest priority was pushing through a new and controversial constitution, which was criticised for its treatment of ethnic minorities and women.

Loading...

This led to violent and deadly protests on the country's southern border with India, and a devastating transport blockade with Nepal's powerful neighbour.

The blockade prompted authorities in Kathmandu to accuse Indian officials of backing the demonstrators — then China came to the rescue.

Beijing sped up reconstruction work on the earthquake-damaged road between the two countries and provided Nepal more than 1.3 million litres of fuel in grants.

"If another neighbour supports a little bit, that is not bad, that is a positive thing," Prime Minister KP Sharma Oli said at the time.

And Beijing has shown that it is keen to keep up the support to its southern neighbour.

"The link between China and Nepal through a railway line is basically designed to draw Nepal more into the Chinese market," Professor Jha said. "That is an issue of concern for India, definitely."

What could go wrong?

Nepal has made democratic gains in recent years, but as elsewhere in Asia, there are fears Beijing's influence could be accompanied by shifts towards authoritarian tendencies.

During Mr Xi's visit he met with Nepalese Communist Party co-chairman Pushpa Kamal Dahal, and according to Xinhua briefed him on how to exercise "full and strict governance over the party" and consolidate "the party's ruling position".

"Nepal's democracy is quite new and it's open to influence," Dr Gamble said.

"I don't think there will be devaluation of the right to vote, but … there are already crackdowns on protests."

And increased influence and support could also make it harder to maintain a free press — to criticise China — Dr Gamble added.

Nepal is one of the poorest countries in Asia. ( AP: Niranjan Shrestha )

Greater influence of Beijing could also spell disaster for the 20,000 Tibetans living in exile in Nepal.

Human Rights Watch has raised concern over a proposed extradition treaty, like that which has sparked rolling protests in Hong Kong, which it claims could put "refugees, activists, and journalists in danger of being sent back [to China] to face unfair trials or the risk of torture and other ill-treatment".

While the extradition treaty was shelved ahead of Mr Xi's visit, that might well change with the deepening of this "ever-lasting friendship".

"China is ready to work with Nepal to implement the consensus of our leaders, scale new heights in our friendly cooperation," China's Foreign Ministry said last night, heralding a "new chapter for relations."