(CNN) What a difference a few weeks make. Just last month India was taking flak from the West for its relationship with Russia.
Not only was the South Asian country refusing to condemn Moscow's brutal assault on Ukraine, but its purchases of discounted Russian oil -- said critics -- were flying in the face of sanctions aimed at crippling the Kremlin's finances.
And the White House was making its displeasure clear, calling New Delhi "somewhat shaky" and speaking of its "disappointment."
Then all of a sudden, the West's tune changed. When Biden met Indian Prime Minister Narendra Modi this month, it was all diplomatic backslapping and soundbites about "a deep connection between our people" and "shared values." Then on Friday British leader Boris Johnson flew into Delhi to talk up trade ties and pose for costumed photo ops, all while glossing over "differences" regarding Russia.
Yet India's stance on Ukraine remains largely the same. It is still buying cheap Russian oil -- in fact, it has bought nearly as much in the first months of 2022 as it did in whole of 2021, according to Reuters -- and it remains quiet on Moscow's invasion. As recently as April 7 it abstained from a UN vote suspending Russia from the Human Rights Council.
India, analysts say, just taught the West a masterclass in international diplomacy.
With India vital to US efforts to counter the rise of China -- seen by the US as potentially an even bigger threat to world peace than Russia -- the West needed to bite its tongue.
Or as Harsh V. Pant, a professor in international relations at King's College London, put it, the United States realized it needed to treat India as a "new partner that needs to be wooed."
Both New Delhi and Washington are becoming increasingly uneasy over China's growing military might, its aggressive territorial claims on land and at sea, and its growing economic influence over its smaller neighbors.
Under President Xi Jinping, China's military -- the People's Liberation Army -- has grown to field the world's largest navy, technologically advanced stealth fighter jets and a growing arsenal of nuclear weapons.
Part of Washington's plan to counter this rests with India's inclusion -- alongside the US, Japan and Australia -- in the increasingly active security grouping known as the Quad, said Pant, who is also head of the Strategic Studies Program at the Observer Research Foundation in New Delhi.
Meanwhile, India has its own concerns with China. The two countries have been engaged in a military standoff along their shared Himalayan border that has claimed dozens of lives in the past couple of years. And, in an irony that won't have been lost on Washington, India relies heavily on Russian arms to equip its military -- including in the Himalayas.
Shared concerns over Chinese aggression were made clear after the Biden-Modi meeting, when US Defense Secretary Lloyd Austin warned China was seeking to "refashion the region and the international system" and said the US and India had "identified new opportunities to extend the operational reach of our militaries."
It was a sign that -- whatever their differences over Ukraine -- the two countries had a deep "understanding of each other's positions," said Manoj Kewalramani, a fellow of China studies at the Takshashila Institution in India.
These concerns help explain why Washington continues to criticize China's silence on Russia's actions in Ukraine, even as it turns quiet on India's.
Superficially, at least, India and China appear to have similar positions on the Ukraine war. Both have positioned themselves as neutral onlookers -- rather than vocal opponents -- both have called for peace and both have refused to condemn the invasion outright.
And both have strategic relationships with Russia that they are keen not to jeopardize.
Chinese President Xi Jinping and Russian leader Vladimir Putin declared in February their relationship had "no limits," while on some estimates India gets more than 50% of its military equipment from Russia.
But these similarities are only superficial. In fact, there are "vast differences," according to Kewalramani.
China has decried Western sanctions and repeatedly blamed the US and NATO for the conflict, parroting Russia's view that NATO precipitated the crisis by expanding eastwards, Kewalramani said. Its state-run media has also amplified Russian talking points and disinformation.
India on the other hand has steered clear of criticizing NATO and appears keen to downplay its differences with the US. There have also been subtle shifts in India's position as the war has progressed.
Modi had talked to Ukrainian President President Volodymyr Zelensky, while China's leaders hadn't, pointed out Li Mingjiang, associate professor in international relations at Nanyang Technological University's S. Rajaratnam School of International Studies in Singapore. India had also been harsher in its criticism of alleged Russian war crimes, Li said.
This month, India's ambassador to the United Nations called the killings of civilians in Bucha "deeply disturbing," condemning them and calling for an open investigation.
Chinese Ambassador Zhang Jun on the other hand said the deaths were "deeply disturbing," but stopped short of attributing blame and urged "all sides" to "avoid unfounded accusations."
Significantly, after the Biden-Modi talks, US Secretary of State Antony Blinken noted India's condemnation of "killing of civilians in Ukraine" and its provision of "humanitarian assistance to the people of Ukraine."
The US may also be recognizing that India's relationship with Russia has historically followed a very different course to that of the West. Blinken noted that India's ties with Russia had "developed over decades, at a time when the United States was not able to be a partner to India."
That appeared to be a reference to the Cold War between the US and the USSR -- during which India was officially nonaligned. However, India began to lean towards the USSR in the 1970s when the US began providing military and financial assistance to its neighbor, Pakistan.
This was when Russia started providing arms to India, and India remains heavily reliant on Russia for military equipment to this day.
In 2018 India inked a $5 billion weapons deal with Russia for an air defense missile system, despite the deal potentially putting it in the crosshairs of Washington's Countering America's Adversaries Through Sanctions Act, a federal law passed in 2017 which imposed new sanctions on Iran, Russia and North Korea.
India's dependence on Russian arms limits its ability to denounce Moscow's actions in Ukraine. When Putin visited Delhi last December, Modi even called Putin a "dear friend."
All this has led to a position in which India is being "wooed by all sides," Pant said.
Moscow remains onside, and remains keen to sell India discounted oil. Russian Foreign Minister Sergey Lavrov even met his counterpart in Delhi this month and praised India for not looking at the Ukraine war "in a one-sided way."
And onside too is the West, ties with which have been growing ever closer since Modi's election in 2014. Annual India-US trade is more than $110 billion, compared to India's trade with Russia, which amounts to about $8 billion. In recent years, India has also become a major customer for US military equipment.
Even so, at Biden's meeting with Modi there remained a hint of unease. The US President urged his Indian counterpart not to step up his country's use of Russian oil, instead offering to help him acquire oil from elsewhere. India, which imports 80% of its oil needs, gets no more than 3% from Russia.
So it appears India has managed to pull off an impressive balancing act.
"India actually comes out very strong from this crisis," Pant said. "And that's quite a feat actually."