THE celebrations in Moscow on May 9th to commemorate the capitulation of Nazi Germany 70 years ago will speak volumes about today’s geopolitics. While Western leaders are staying away in protest against Russia’s aggression in Ukraine (and the first annexation of sovereign territory in Europe since the second world war), China’s president, Xi Jinping, will be the guest of honour of his friend, Vladimir Putin. Western sanctions over Ukraine, and what looks set to be a long-term chilling of relations with America and Europe, has given Russia no option other than to embrace China as tightly as it can.

Next week, in a further symbol of the growing strategic partnership between the two countries, three or four Chinese and six Russian naval vessels will meet up to conduct live-fire drills in the eastern Mediterranean. The exercise, which follows several similar ones in the Pacific since 2013, aims to send a clear message to America and its allies. For Russia the manoeuvres signal that it has a powerful friend and a military relationship with a growing geographic reach. For China even a small-scale exercise of this kind (its ships are coming from anti-piracy duty in the Gulf of Aden) speaks of increasing global ambition in line with Mr Xi’s slogan about a “Chinese dream”, which he says includes a “dream of a strong armed-forces”.

At a more practical level, the exercise provides a shop-window for China’s Type 054A guided-missile frigate, which it would like to sell to the Russians. It also offers operational experience in an unstable region in which it has an expanding economic presence. In 2011 China organised the evacuation of more than 38,000 Chinese from Libya during that country’s upheaval. Last month its navy pulled several hundred of its citizens out of Yemen, which is being torn apart by civil war. There are thought to be at least 40,000 Chinese working in Algeria and more than 1m across Africa.

Relations between China and Russia have been growing closer since the end of the cold war. Both, for different reasons, resent America’s “hegemony” and share a desire for a more multipolar world order. Russia, a declining great power, is looking for ways to recover at least some of its lost status; whereas China, a rising power, bridles at what it sees as American attempts to constrain it. As fellow permanent members of the UN Security Council, both with autocratic governments, Russia and China find common cause in sniping at Western liberal interventionism. The two countries settled all of their long-standing border disputes in 2008, just a month before the Russian-choreographed war in Georgia. Russia saw the deal as a way for it to concentrate more of its military forces in the west as a deterrent against the further expansion of NATO.

But there have been occasional tensions. Russia played a key role during the 1990s in helping China to modernise its military forces. Russia was able to preserve a defence-industrial base that would otherwise have withered from lack of domestic orders. But since the middle of the last decade, irked by China’s theft of its military technology and its consequent emergence as a rival in the arms market, Russia’s weapons sales to its neighbour have slowed.

Russia is also wary of becoming little more than a supplier of natural resources to China’s industrial machine—a humiliating position for a country that until recently saw China as backward. As long as Russia could sell to Europe all the gas required to keep the Russian economy growing, it could put deals with China on hold. These included plans for two gas pipelines from Siberia into China that were announced in 2006 and then quietly dropped as the two sides bickered over prices.

All that has changed. The Ukrainian crisis is, as Russian media put it, forcing Russia to “pivot” its economy towards Asia in an effort to lessen the impact of Western sanctions by finding alternative markets and sources of capital. For China it is a golden opportunity to gain greater access to Russia’s natural resources, at favourable prices, as well as to secure access to big infrastructure contracts that might have gone to Western competitors and to provide financing for projects that will benefit Chinese firms.

In theory, Russia’s incursions into Ukraine and its seizure of Crimea violate two of China’s most consistently held foreign-policy tenets: non-interference in other states and separatism of any kind. But China abstained from voting on the UN Security Council resolutions condemning Russia, while Chinese media have given Russia strong support. China has quietly welcomed a new cold war in Europe that might distract America from its declared “rebalancing” towards Asia.

Striking evidence of the new closeness between China and Russia was a $400 billion gas deal signed in May last year under which Russia will supply China with 38 billion cubic metres (bcm) of gas annually from 2018 for 30 years. At China’s insistence, the gas will come from new fields in eastern Siberia and will pass through an as yet unbuilt pipeline—the better for ensuring that it will not be diverted elsewhere. Other deals have followed. The biggest was a preliminary agreement signed in November for Russia to sell an additional 30 bcm a year through a proposed pipeline from western Siberia. In every instance it is probable that China was able to drive a hard bargain on price.

Russia’s weakness was also clear in its recent decision to resume high-tech arms exports to China. In April it agreed to sell China an air-defence system, the S-400, for about $3 billion. This will help give China dominance of the air over Taiwan and the Senkaku islands (Diaoyu to the Chinese, who dispute Japan’s claim to them). In November Russia said it was prepared to sell China its latest Sukhoi-35S combat aircraft. Initially it had refused to sell any fewer than 48, in order to make up for losses it calculated it would suffer as a result of China’s inevitable pilfering of the designs. Now it has meekly agreed to sell only 24.

But problems ahead are discernible. One is that both countries are competing for influence in Central Asia, once Russia’s backyard (Mr Xi was due to head there before proceeding to Moscow). Mr Putin wants to establish his Eurasian Economic Union partly to counter growing Chinese economic power in Central Asia, through which China wants to develop what it calls a Silk Road Economic Belt. China is using the Shanghai Co-operation Organisation (SCO), of which Russia and Central Asian nations are also members, to boost its security ties in the region as well: it often holds counter-terrorism exercises with its SCO partners. Another difficulty is Russia’s military and energy links with countries such as India and Vietnam, both of which are rivals of China. But the biggest problem of all may be Russia’s irritation with being forced into an increasingly subservient role in its relations with China. For Russia the partnership with China has become painfully necessary. For China it is nice to have, but far from essential.