Perched atop the Himalayas, and wedged between the world’s most populous nations, Nepal has always been of strategic importance that belies its small size.

Home to one-third of the Himalayan mountains, also known as Asia’s water tower thanks to the rivers that flow down both sides of the range, Nepal has served as a buffer state for India since China gained control of Tibet. For the Chinese, Nepal is part of the “New Silk Road” project that aims to connect Asia with Europe, and a key ally in China’s crackdown on the Tibetan independence movement.

After the worst earthquake in decades devastated large swathes of Nepal, one of the world’s poorest nations, both powerful neighbours have moved swiftly to help out the rattled mountainous country of 28 million people.

“Both countries want to establish a good image in Nepal, and win the hearts of the Nepalese people,” Joseph Cheng, a professor of political science at City University in Hong Kong, told Quartz. “Extending a hand of help to Nepal at this juncture is important for image-building, and to build their respective influence in the country,” he said.

CIA World Fact Book Nepal

Although the current focus is firmly on helping the survivors get medical attention and necessities, eventually India and China are expected to play crucial roles in the long and expensive job of helping reconstruct the country itself. That’s when the geopolitical wrangling over this strategically important nation is likely to intensify.

“Once the immediate relief and rescue work is done, it will be time to build critical infrastructure,” Rajrishi Singhal, senior geo-economics fellow at Mumbai-based think-tank Gateway House, told Quartz. ”China has been building roads along their border, and India will be of great help in developing infrastructure [including] health, education and telecom,” he predicts.

There’s going to be plenty to do. Initial estimates of the cost of the disaster are pegged at between $1 billion and $10 billion—the two days of earthquakes could have pushed the country’s economy back by a decade or more.

China’s growing influence

For years New Delhi’s influence over Nepal has waned, as the Chinese have gained traction. Despite a history of political, economic and social intimacy, and the fact that Nepal’s currency is pegged to the Indian rupee, successive Indian governments failed to engage with their Nepali counterparts.

Last August, Narendra Modi became the first Indian prime minister to visit Nepal in 17 years.

Alongside a number of bilateral agreements, Modi also offered $1 billion in concessional loans to Nepal. “Nepal can use this on hydropower and infrastructure projects of its choice,” he said. That money will now come in handy as Kathmandu will need to launch a massive rebuilding effort.

But those loans come after China has been building ties in Nepal for years. China became Nepal’s biggest foreign investor in 2014, and the Nepali government awarded a contract to China’s Three Gorges International Corp. to build a $1.6 billion hydropower project. Chinese engineers are also building Nepal’s first eight-lane highway, and Nepal’s imports from China grew by 67% between 2010 and 2013.

The Chinese overtures in Nepal began in earnest in 2008, after Beijing lost its “most reliable partner” in the country—the monarchy, which controlled the armed forces. Indian analysts believe the Chinese have supported the country’s ruling Maoist party after their guerrilla war that deposed the king, as a 2014 briefing paper (pdf) by New Delhi’s Institute of Peace and Conflict Studies explains:

China needed a trustworthy partner in Nepal. It became obvious that it has to choose between two major political forces in Nepal: the democratic parties, which were mostly pro-India, and the Maoists, a large party with anti-India and anti-US sentiments. China also found it expedient to cultivate the Maoists because of the growing tensions in Tibet, particularly after the March 2008 uprising when Tibetans strongly started its anti-China protest around the world on the eve of the Olympic Games to embarrass China among the international community.

In 2008, the Communist Party of Nepal (Maoist) won the largest number of seats in the constituent assembly. The party’s chief, Pushpa Kamal Dahal, was elected the prime minister but resigned nine months later following a tiff with the Army. In 2013, when elections were held again, Maoist parties were defeated, and Nepal is currently ruled by the Nepali Congress.

The pro-democracy Nepali Congress, founded in 1947, has had deep friendly ties with India historically, but that could change with China spending more than India in the country.

Modi wipes tears, Xi pledges anything necessary

As the massive earthquake struck late in the morning of April 25, India was perhaps the quickest in providing immediate assistance to Nepal.

Four hours after the tremors hit, India flew out its first team of relief personnel. Subsequently, over 280 Indian first responders have arrived in Nepal on over a dozen Air force planes and helicopters. This has been among New Delhi’s fastest—and perhaps most expensive—response to any natural disaster in a neighbouring country.

“…India will make all efforts to wipe the tears of every person in Nepal, hold their hands and stand with them,” Modi said in a radio broadcast on April 26.

“Prime minister Modi has taken a much more public call for assistance than his Chinese counterpart in part because India has a much closer relationship,” Walter Andersen, director of the South Asia Studies programme at John Hopkins University, said in an email. “My guess is that India’s generosity will have a positive impact on Nepali views regarding India and may make it easier to work out the problems that have delayed projects.”

China’s president Xi Jinping also pledged to help, and attached a number instead of sentiment to the pledge. “The Chinese side is willing to offer all necessary disaster assistance to the Nepalese side,” Xi said in a statement. A day after the earthquake hit, Beijing dispatched a 62-member relief team and plans to send in emergency aid including tents, generators, water purification equipment and medical supplies. The Chinese government promised 20 million yuan ($3.3 million) in aid, three times the US.

For both nations, there’s more behind the aid than just humanitarianism and closer ties with Nepal. China and India are also eager to demonstrate their good will and influence as major powers, said City University’s Cheng. They want the world to know “they are major powers with increasing economic resources, and are ready to behave like a friendly regional power.”

China has been ramping up spending and economic ties in the region for years, so the message is particularly important for India. “India has sent out a strong message to its neighbours in the regions who have been watching India’s response,” said Singhal. “Hopefully, India will be seen as a more reliable super power in the region now who uses its might in times of need.”

Plenty of work for both nations

The earthquake’s destruction comes on top of Nepal’s ongoing issues. “The infrastructure destroyed during the people’s war of 1996-2006 has still not been rebuilt,” Nishchal N. Pandey, director at the Centre for South Asian Studies in Kathmandu, told Quartz. “It’s going to take decades to reconstruct this.”

Both India and China will be vying for infrastructure contracts, and to provide aid that could bring Nepal closer.

“One area of importance to both is the rebuilding of infrastructure,” said John Hopkins University’s Andersen. But beyond that, there are plenty of new types of aid that India and China can offer Nepal. “India also has an agreement to supply a range of items at reduced price (such as refined oil), and my guess is the supply of that will increased and almost certainly speeded up,” he said.