BEIJING (AP) — Three weeks ago, the leaders of China and Russia declared that the friendship between their countries “has no limits” as they met in Beijing on the eve of the Winter Olympics. But that was before Russia's invasion of Ukraine, a gambit that is testing just how far China is willing to go.

The nuclear-armed neighboring giants have grown closer in recent years, raising the specter of an alliance of authoritarian states that could challenge a U.S.-led democratic West in a new Cold War. Yet China has much to lose in such a scenario, and President Xi Jinping has spoken out against the “Cold War mentality” of those who portray his country's rise as a threat.

The emergence of a China-Russia axis is far from a foregone conclusion. Trade with Europe and the United States is a major driver of China's economic growth, even as its estrangement with the U.S. and its appetite for energy have led it to deepen ties with Russia.

“The ongoing conflict in Ukraine will reveal whether there is a deeper bond or whether the relationship is essentially transactional,” Anthony Saich, a China expert said in a Q&A posted on the website of Harvard University’s Ash Center for Democratic Governance and Innovation.

He outlined three possible actions that would indicate “China has thrown its lot in with Russia." These include Beijing using a veto, rather than an abstention, of any U.N. resolution to criticize Russia’s actions; recognition of a puppet regime in Ukraine put in place by Russia; and a refusal to call the attack an invasion even after civilian deaths are clearly confirmed.

China, along with India and the United Arab Emirates, already abstained from voting on a U.N. Security Council resolution Friday demanding Russia stop its attack on Ukraine. Russia vetoed it. China abstained again on another vote on Sunday, though it was a procedural one not open to veto.

“The two abstentions show that China has adopted a more prudent attitude than before amid the extremely broad criticism and protest of the world against Russia’s all-round attacks,” said Shi Yinhong, an international relations expert at Renmin University of China.

Li Fan, a Russian studies professor at Renmin, said that China and Russia have “a neighborly, friendly strategic partnership” but that China isn’t taking sides in the current crisis. “It is not that China supports Russia’s military operation,” she said.

Russia’s move to put its nuclear forces on high alert Sunday, escalating the crisis, may make China more cautious.

This balancing act helps explain Beijing's sometimes contradictory positions on Russia's invasion of Ukraine and the assiduous efforts of officials to avoid getting pinned down on certain questions — including whether they call what's happening an invasion.

China has said that the sovereignty and territorial integrity of all nations must be respected — a stance that runs counter to an invasion — while also opposing sanctions on Russia and blaming the U.S. and NATO's eastward expansion for being the root cause of the crisis.

“China is trying to have its cake on Ukraine and eat it too," Asia Society president and former Australian Prime Minister Kevin Rudd wrote in a post on the Asia Society Policy Institute website. He noted that China has lifted import restrictions on Russian wheat, which could offset some of the economic pain of sanctions.

For many of those imposing sanctions, China's actions amount to support for the invasion.

“You don’t go and throw a lifeline to Russia in the middle of a period when they’re invading another country,” Australia's current Prime Minister Scott Morrison said.

In a series of calls with European counterparts late last week, Foreign Minister Wang Yi said “the present situation is something we do not want to see.” He called for talks to end the crisis, but he withheld from criticizing Russia.

It is unclear whether Putin sought Xi's support when he came to Beijing for the opening ceremony of the Winter Olympics on Feb. 4. The Russian leader's attendance was a face-saving event for Xi after the U.S. announced a diplomatic boycott over China's human rights record and many major countries didn't send representatives.

A joint statement was issued after Xi and Putin met that declared “friendship between the two states has no limits, there are no ‘forbidden’ areas of cooperation.”

Without mentioning Ukraine, the Russo-Chinese statement clearly opposed NATO expansion and coalitions that “intensify geopolitical rivalry" — a likely reference to U.S. President Joe Biden's efforts to strengthen ties with other democratic nations in the face of China's rise.

It accused unnamed “actors” of advocating unilateral approaches and resorting to force to address international issues, which could apply not only to the U.S. wars in Iraq and Afghanistan, but also Russia’s war in Ukraine.

The communique also declared the “new inter-state relations between Russia and China are superior to political and military alliances of the Cold War era."

Harvard's Saich called the statement “a dramatic step forward in the relationship” but added it is premature to consider it a definitive alliance.

Half a century ago, in the midst of the Cold War, it was China and the United States who found common cause against Russia. This month marks the 50th anniversary of President Richard Nixon's groundbreaking 1972 trip to China.

At the time, China's ties with the Soviet Union had soured, and its leaders were worried about a Soviet invasion. Fifty years later, the relationship among the three great powers has changed in hard-to-imagine ways. U.S.-China ties are on the rocks, and Beijing and Moscow are reaching out to each other instead.

___

EDITOR'S NOTE — Ken Moritsugu, AP news director for Greater China, has covered Asia for more than 16 years.

___

Follow AP’s coverage of the Ukraine crisis at https://apnews.com/hub/russia-ukraine

Copyright 2022 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.