BEIJING -- The nuclear test by North Korea on Tuesday, in defiance of warnings by China, leaves the new Chinese leader, Xi Jinping, with a choice: Does he upset North Korea just a bit by agreeing to stepped up United Nations sanctions, or does he rattle the regime by pulling the plug on infusions of Chinese oil and investments that keep North Korea afloat?
The test poses a major foreign policy challenge to Mr. Xi, the new head of the Communist Party, who has said he wants the United States and China to develop a "new type of relationship between two great powers." How Mr. Xi deals with North Korea in the coming period could tell the United States what kind of leader he will be and what kind of relationship he envisions with Washington.
Already he has shown himself to be more of a nationalist than his predecessor, Hu Jintao, displaying China's determination to prevail in the East China Sea crisis in which China is trying to wrest control of islands administered by Japan. He has also displayed considerably more interest in China's military, visiting bases and troops in the last two months with blandishments to soldiers to be combat ready.
To improve the strained relationship with the United States, Mr. Xi could start with getting tougher on North Korea, harnessing China's clout with the outlier government to help slow down its nuclear program. If Mr. Xi does not help in curbing the North Koreans, he will almost certainly face accelerated ballistic missile defense efforts by the United States in Northeast Asia, especially with Japan, an unpalatable situation for China.
But if Mr. Xi took the measures against North Korea that the United States wants, Chinese and American analysts say, Mr. Xi would risk destabilizing North Korea, spurring its collapse and pushing the creation of a unified Korean Peninsula that could well turn out to be an American ally. An American-controlled Korean Peninsula is not an option for Mr. Xi, the analysts agree.
The first reaction from the Chinese government was relatively mild, and suggested no immediate change in policy or attitude toward North Korea. A statement on the Foreign Ministry Web site said that the government was expressing its "staunch opposition" to the test and "strongly urges" North Korea to abide by its commitment to denuclearization.
Later in the day, the Chinese foreign minister, Yang Jiechi, summoned the North Korean ambassador, Ji Jae Ryong, to express his opposition to the test.
After North Korea's second nuclear test in 2009, the Obama administration excoriated Mr. Hu, accusing him of "willful blindness" to the country's actions.
"With Hu out of the picture the administration is intent on determining whether Xi Jinping will prove more attentive to U.S. security concerns," Jonathan D. Pollack, director of the John L. Thornton China Center at the Brookings Institution said. "How Xi chooses to respond will be an important early signal of his foreign policy priorities and whether he is ready to cooperate much more openly and fully with Washington and Seoul than his predecessor."
A more heightened debate about North Korea is now swirling around China's foreign policy circles, but whether the voices of a tough policy on North Korea can prevail remains very uncertain.
Despite the increasing concern in some quarters about North Korea's wayward behavior, that dread of losing a buffer still prevails among China's most influential policy makers, particularly in the military, according to Jia Qingguo, a professor at the School of International Studies at Beijing University who is a proponent of a new policy toward North Korea.
"It's better than before, but it is still difficult to overcome" the mind-set, he said. "A lot of people are taking the very old-fashioned belief that North Korea is a strategic buffer, and they still believe American invaders would march over North Korea to come to China."
Professor Jia, who visited Washington last month, says China should use wayward North Korea as a starting point for a more cooperative relationship with the United States. "One option is North Korea," he said. "We have to work together to stop it becoming a nuclear power."
Zhu Feng, a professor of international relations at Beijing University who is also a proponent of a tougher stance against North Korea, said Chinese news media accounts stressing the need for punishing North Korea in a more meaningful way were an encouraging sign.
"They are quite rare signals, and I don't recall any moment during the past 10 years that Beijing unequivocally and forcefully spoke up against Pyongyang's nuclear tricks," he said.
Professor Zhu described Mr. Hu as "indecisive" on North Korea. While Mr. Xi is seen as a "more nationalistic" leader, he is also "more pragmatic," and sees that Beijing has run out of "good will options," Professor Zhu said.
China agreed to join the United States in backing new United Nations sanctions against the North after the successful test in December of a missile that reached the Philippines.
In response to China's joining the sanctions, North Korea unleashed a scathing attack on China and vowed to push ahead with the third nuclear test. China will almost certainly join a new round of sanctions, Chinese analysts said.
But for all China's distaste for North Korea -- culturally and politically the two governments stand far apart -- China will most likely remain a firm ally of North Korea, said Stephanie Kleine-Ahlbrandt, North East Asia director and China adviser for the International Crisis Group in Beijing.
"The traditionalists in the People's Liberation Army and the International Liaison Department of the Communist Party control North Korea policy," she said. "The political relationship between China and North Korea right now is at a low point, but China's longstanding priorities on the Korean Peninsula of no war, no instability and no nukes remain in that order of priority."
China was prepared to live with a nuclear North Korea as long as the arsenal remained small and its nuclear status did not result in an arms race, she said.
But the third nuclear test takes North Korea another step closer to a nuclear weapon that can reach the United States, even though that accomplishment may be years away, said Siegfried S. Hecker, former director of the Los Alamos National Laboratory and co-director of the Center for International Security and Cooperation, at Stanford University. He visited North Korea two years ago and was shown the country's uranium enrichment facilities.
If China fails to rein in North Korea, the United States will become increasingly impatient and ratchet up its defense capacities in Asia, and those of its allies, Mr. Hecker said.
"What is quite apparent to me is that threatening a missile-capable warhead with a successful third nuclear test gives the United States, South Korea and Japan good reason to step up their regional ballistic missile defense capabilities -- that should give the Chinese government some pause."
This article originally appeared in The New York Times.