When Sri Lanka unexpectedly turfed out President Mahinda Rajapaksa in an election this month, it was the biggest setback in decades for China's expansion into South Asia - and a remarkable diplomatic victory for India.
Despite New Delhi's protestations, diplomats and politicians in the region say India played a role in organising the opposition against pro-China Rajapaksa.
His successor, President Maithripala Sirisena, has said India is the "first, main concern" of his foreign policy and that he will review all projects awarded to Chinese firms, including a sea reclamation development in Colombo that would give Beijing a strategic toehold on India's doorstep.
India has pushed back against China elsewhere in the region since Prime Minister Narendra Modi took office in May, improving ties with Japan and Vietnam, both locked in territorial disputes with Beijing, and contesting a port project in Bangladesh that could otherwise have been a cakewalk for China.
The new robust diplomacy, which Modi calls "Act East", has delighted Washington, which has been nudging India for years to dovetail with the US strategic pivot toward the region.
When President Barack Obama makes a landmark visit to India starting Sunday, he will be the chief guest at New Delhi's showpiece Republic Day military parade, and rarely for a presidential trip, is not scheduled to visit any other country before returning to Washington.
"What is appealing to me and my colleagues is the fact that Prime Minister Modi has undertaken to build from what has been a 'Look East' policy to an 'Act East' policy," US Assistant Secretary of State for East Asia and the Pacific Daniel Russel said in Washington last month.
"He has shown in word and deed his interest in involving India in the thinking and the affairs of the broader region. That's very much to be welcomed."
Washington made no bones about its distaste for Rajapaksa, who critics accuse of war crimes, corruption and nepotism. But until last year India was indecisive, perhaps afraid of pushing the hero of the war against Tamil separatists even closer to China.
That changed in September, when Rajapaksa allowed a Chinese submarine to dock in Colombo, without informing India, as it was bound to under an existing agreement.
"That was the last straw," a senior Indian diplomat told Reuters.
"He told Modi: "the next time I will keep you informed,"" the diplomat said, a promise that was broken when the submarine visited again in November.
In the build up to the Jan 8 election, India played a role in uniting Sri Lanka's usually fractious opposition, for which the station chief of India's spy agency was expelled, diplomatic and political sources say.
"At least that was the perception of Mahinda Rajapaksa," said M.A. Sumanthiran, a prominent member of the Tamil National Alliance, a coalition of parties close to India. "He managed to get one of their top diplomats recalled."
The Indian government denies any of its officers was expelled. But Sumanthiran said Modi had in a meeting encouraged the Tamil alliance to join forces with others in politics.
"The Indians realised that you can't do business with this man and they were hoping for a change," he said.
On Friday, Sri Lanka said it would review a $1.5 billion deal with China Communication Construction Co Ltd to build a 233 hectare patch of real estate on redeveloped land overlooking Colombo's South Port.
In return, China was to get land on a freehold basis in the development. This is of particular concern for India, the destination for the majority of the trans shipment cargo through Colombo.
"The message is clear, that you do not ignore Indian security concerns," said the Indian diplomatic source.
Modi is looking for similar good news elsewhere in South Asia. He has already visited Nepal twice, becoming the first Indian prime minister to travel to the Himalayan buffer state with China in 17 years, and signing long delayed power projects.
India has muscled into an $8 billion deep water port project that Bangladesh wants to develop in Sonadia in the Bay of Bengal, with the Adani Group, a company close to Modi, submitting a proposal in October. China Harbour Engineering Company, an early bidder, was previously the front-runner.
"Modi is willing to engage on long-term issues that stretch beyond India's border, including maritime security in the South China Sea, as well as North Korea and Islamic State militants in Iraq and Syria," said Richard Rossow at policy think tank CSIS.
"That's when we start to think about India as a regional global provider - or as a global provider of security."
However, the bonhomie has limits - India and the United States do not see eye-to-eye on Pakistan, New Delhi's traditional foe that enjoys substantial funding from Washington.
Tricky conflicts over trade and intellectual property hold back business, and India has limits to its ability to project force outside its immediate neighbourhood.
But Modi's policies mark a departure from India's traditional non-aligned approach to foreign power blocs.
"Having the US president at the Republic Day celebration is a good thing, he is blessing Modi," said Mohan Guruswamy, of the Centre for Policy Alternatives, a think-tank.
"And that is a lesson to the Chinese that you have to mend your fences with us."
(Additional reporting by Shihar Aneez in Colombo; David Brunnstrom and Roberta Rampton in Washington)