By LOUISE WATT

Associated Press

SHANGHAI (AP) _ China is carrying on a high-stakes balancing act aimed at building influence and access to resources abroad without damaging ties with its most important economic partner _ the United States.

In rapid-fire moves Wednesday, President Xi Jinping called at a conference of Asian governments for a new regional security structure that implicitly excludes Washington. Hours later, China agreed to buy Russian gas worth about $400 billion, binding the diplomatically isolated government of President Vladimir Putin more closely to Beijing and the huge Chinese economy.

Russian politicians hailed the deal as part of a new strategic relationship and a thumb in Washington’s eye. But Xi also appeared to be trying to reassure the United States and its Asian allies. In his speech to an audience that included Putin and the president of Iran, the Chinese leader said a military alliance that was offensive in posture rather than defensive would not help regional security.

Irked by the Obama administration’s effort to shift its foreign policy emphasis to Asia at a time of Chinese territorial disputes with Japan, Vietnam and other neighbors, Beijing is nevertheless treading carefully because it knows it cannot dominate any international organization, experts say. Instead, it is pressing to have its needs respected abroad.

Chinese leaders place “top priority” on the relationship with the U.S. even as they worry Washington is trying to contain their country’s rise, said Joseph Cheng, a specialist in Chinese politics at the City University of Hong Kong.

At the same time as it strengthens ties with Russia, Beijing will “try its very best to maintain a cordial relationship with the U.S.,” said Cheng.

China has been steadily raising its profile abroad since the late 1990s, emerging from decades when it followed the late supreme leader Deng Xiaoping’s injunction to maintain a low profile and focus on economic development.

“The Chinese government has been calling for security cooperation based on communities rather than alliances, where third-parties are not targeted and there is a focus on respecting sovereignty and joint problem-solving,” said Marc Lanteigne, director of research at the New Zealand Contemporary China Research Centre of Victoria University of Wellington.

Xi invoked such ideals Wednesday when he called for a “new regional security cooperation architecture” that covers all of Asia based on a previously obscure group, the Conference on Interaction and Confidence Building Measures in Asia, founded in 1992 as a regional discussion forum.

He called for a “defense consultation mechanism” and a “security response center” for major emergencies but gave no details.

Such organizations show countries such as China and Russia are “more eager to embrace multilateralism” than the United States, said Cheng.

“The U.S. has to accept that, even though it remains the sole superpower,” he said.

In Southeast Asia, Beijing has displayed its growing diplomatic skill by playing on rivalries among the region’s governments to prevent them from siding with Vietnam in the conflict over a Chinese oil rig sent to disputed waters.

Chinese leaders have been trying to build up groups of Asian and developing governments to offset the influence of the United States and other Western nations in global affairs.

Still, forging any but the loosest ties between CICA’s 24 member nations would be a diplomatic challenge. They range from Iran to U.S. allies such as Israel and South Korea. Others such as Mongolia and Vietnam are wary of growing Chinese influence.

Beijing and Moscow, once rivals for leadership of the communist movement, have built a strategic partnership since the end of the Soviet Union in the early 1990s, driven by their shared unease at U.S. dominance.

In 2001, they co-founded the Shanghai Cooperation Organization with four Central Asian governments to counterbalance rising American influence in the region and combat Islamic and separatist political movements. China has avoided promoting the group as a security organization or admitting Iran as a full member, possibly out of fear of provoking a Western backlash.

Wednesday’s gas deal highlights the mix of interests and potential conflicts between Beijing and Moscow.

An agreement was important to both sides but they haggled for more than a decade over the price, a hard-headed commercial issue.

The gas deal helps Russia out of its isolation by Western governments unhappy with its role in the Ukraine crisis. Russian state behemoth Gazprom will be able to reduce its reliance on European customers while meeting some of China’s pressing energy needs.

Washington warned China it didn’t want any other nations doing business deals with Moscow to detract from sanctions imposed over Ukraine but said it understood the Chinese economy’s need for energy.

“Chinese officials clearly understood the distinction between deals in which there have been ongoing negotiations for some time and new deals that opportunistically fill the space left by U.S. and EU sanctions,” the U.S. Treasury said in an email.

Despite declarations of friendship, China’s $89 billion in trade with Russia last year was barely one-sixth its $521 billion in total imports and exports with the United States, also an important source of investment and technology.

Russia and China see each other as rivals in the global balance of power, said Mark Harrison, an economist at the University of Warwick, in an email.

“The balance of power in Asia is moving steadily against Russia,” he said. “Smiles around the table in Beijing do not betoken true affinity.”