Sri Lanka's strategic location has attracted outsized interest in the small island nation from regional giants China and India for more than a decade, with Beijing and its free-flowing loans and infrastructure investments widely seen as having gained the upper hand in the quest for influence.
But Sri Lanka's economic collapse has proved an opportunity for India to swing the pendulum back, with New Delhi stepping in with massive financial and material assistance to its neighbor.
"There is no such thing as charity in international politics," said Sreeram Chaulia, who heads the School of International Affairs at O.P. Jindal University in Sonipat, India.
"The intent is to drive China away from India's backyard and restore the balance in New Delhi's favor."
Sri Lanka, a country of 22 million, sits off the southern coast of India on the Indian Ocean shipping lanes through which China receives the vast majority of its imported oil from the Middle East.
As part of Chinese President Xi Jinping's Belt and Road Initiative to pump money into infrastructure projects across Asia and Africa, former Sri Lankan President Mahinda Rajapaksa took on many loans, including $1.1 billion to build a port in his home region of Hambantota despite the plan having been rejected by an expert panel.
When the deep-water port failed to generate the foreign revenue needed to pay China back, Sri Lanka in 2017 was forced to hand the facility and thousands of acres of land around it to Beijing for 99 years — giving China a key foothold directly opposite regional rival India's coastline.
That stoked India's ongoing concerns about China's growing influence in South Asia, particularly in smaller countries like Sri Lanka, Nepal and Maldives.
Concerns over China's increasing regional assertiveness deepened in 2020 when Indian and Chinese soldiers clashed in deadly skirmishes on the disputed Himalayan Ladakh border.
In its maritime approach, Beijing's military focus is currently more on the South China Sea and the Pacific, while its interest in Sri Lanka and the Indian Ocean appears to be more economically motivated, said Rahul Roy-Chaudhury, a London-based analyst with the International Institute for Strategic Studies.
"On the security side for China it's not a priority, but it is an emerging opportunity for China to bolster its influence in South Asia and ... to counter India's influence," he said.
Caught in between is Sri Lanka itself which, like many others in the region, needs both China and India, whose combined population is nearly 3 billion people, Roy-Chaudhury said.
"It's not black and white," he said. "The leaders of these countries have to be pro-India and pro-China at the same time."
Sajith Premadasa, the current Sri Lankan opposition leader, emphasized that while the country is "extremely grateful" for India's help in the current crisis, the government needs to ensure that Sri Lanka's sovereignty and political independence are not impacted by the situation.
"What Sri Lanka should do always is to ensure our own national interests — in order to maximize our own national interests," he told The Associated Press. "We should work with everyone in international society, irrespective of which power group or power bloc anybody belongs to."
Sri Lanka has been rocked by protests since April after its foreign currency reserves ran dry, leading to widespread food and fuel shortages and power cuts, with demonstrators calling for the resignation of President Gotabaya Rajapaksa, the brother of Mahinda Rajapaksa who was elected in 2019.
In May, Mahinda, who had been appointed prime minister, himself resigned, but Gotabaya has clung to power.
Gotabaya inherited an economy already in a slump after a series of attacks in early 2019 by Islamic extremists caused a dramatic drop-off in tourism, a major source of income, and enormous foreign debt from infrastructure projects, many bankrolled by Chinese money and commissioned by brother Mahinda.
But a series of unwise economic decisions made the situation worse, and it was further exacerbated by the global coronavirus hitting the tourism sector again, while the war in Ukraine has driven up food and fuel costs.
The government now owes $51 billion and is unable to make interest payments. It has suspended repayment of $7 billion in foreign debt due this year out of $25 billion to be repaid by 2026, pending the outcome of negotiations with the International Monetary Fund on a rescue package.
China, Sri Lanka's third largest creditor after Japan and the Asian Development Bank, accounts for about 10% of its debt.
China has offered to lend more on favorable terms but has balked at forgiving some of Sri Lanka's debt, possibly over concerns it would prompt other borrowers across Asia and Africa to demand the same relief.
But Prime Minister Ranil Wickremesinghe, who took office after Mahinda Rajapaksa resigned, has said that Sri Lanka has not been able to access $1.5 billion in loans offered by China, because Beijing has made the money contingent on the country having enough foreign reserves for three months.
Beijing has also promised to "play a positive role" in Sri Lanka's talks with the IMF and is providing some 500 million yuan, about $75 million, in humanitarian aid, according to Chinese Foreign Ministry spokesman Zhao Lijan.
Meanwhile, India has stepped in with millions of dollars worth of rice, milk powder, medicine and other humanitarian aid, as well as diesel fuel and gasoline.
India has also extended Sri Lanka a $4 billion credit line on favorable terms that has been widely credited with helping the country's crisis from worsening, even as Wickremesinghe last week declared the economy had "completely collapsed."
Wickremesinghe, who has served as prime minister several times before, is seen as pro-India, though he has limited leverage in his current role with Gotabaya Rajapaksa remaining president.
While the Rajapaksa family is considered pro-China, and with the general perception that China has been partially responsible for the country's problems, the political winds seem to be shifting in India's favor, Chaulia said.
India has not been actively promoting the perception that Chinese loans contributed to the crisis in Sri Lanka, but it also has not fought it, seeing the idea of a Chinese "debt trap" as an advantageous narrative for it regionally.
"India is not worried if this message comes across," Roy-Chaudhury said.
New Delhi has recently succeeded in wresting away some of Beijing's important projects in Sri Lanka, which is also a major destination for Indian exports.
In March, Sri Lanka finalized a joint venture with India to develop a solar power plant in the island nation. That same month, Colombo also terminated a contract with a Chinese company to build a $12 million wind farm in the country and offered it to an Indian rival.
"While India is trying to maintain its strategic footprint in Sri Lanka, its main aim appears to be to minimize Chinese hold in the country," said K C Singh, a former Indian foreign secretary and a strategic affairs expert.
Coming to Sri Lanka's aid also fits neatly into Indian Prime Minister Narendra Modi's "Neighborhood First" foreign policy initiative, which focuses on cultivating and sustaining relations with nearby countries, and it is also in India's self interest not to have a neighboring country like Sri Lanka collapse into chaos, Roy-Chaudhury said.
But at the same time India does not want to find itself in a position where it is stuck alone with an economic bailout, so it has been pushing Sri Lanka to turn to the IMF and asking for other countries to help.
"In security terms, yes, it would want to be a preferred security partner," Roy-Chaudhury said.
"In economic terms, I think it would want to be one of a number of countries providing economic reassurance or support."