DANDONG, China (AP) — North Korea's nuclear test Tuesday could push China to take a tougher stance against its longtime ally.

Beijing had earlier signaled a growing unhappiness with Pyongyang by agreeing to tightened U.N. sanctions after North Korea launched a rocket in December, surprising China watchers with its unusually tough line, which prompted harsh criticism from Pyongyang.

And while China isn't expected to abandon its communist neighbor, it appears to be reassessing ties a year after new North Korean leader Kim Jong Un took office. The question is for how long China, itself under new leader Xi Jinping, will continue to back North Korea's nettlesome policies.

"Perhaps Kim Jong Un thinks Xi Jinping will indulge him. Perhaps he's in for a surprise," said Richard Bush, Director of the Center for Northeast Asian Policy Studies at the Brookings Institution in Washington D.C.

However, the Foreign Ministry's initial statement was relatively mild and echoed almost word-for-word China's responses to North Korea's first two nuclear tests in 2006 and 2009.

It said China expressed its "firm opposition" to the test, urged a calm response by all sides, and called for new denuclearization talks.

China's state broadcaster reported on the earthquake that was the first indication that North Korea might have conducted a test. CCTV quoted residents living along the North Korean border in Jilin province as saying they felt the ground shaking for about one minute around the time the quake hit. North Korea later confirmed carrying out the test.

China is feeling spurned by Kim. Although China welcomed his ascension after his father died in December 2011 and maintained flows of aid and investment, Kim has ignored China's interests in a stable neighborhood with his two rocket launches and nuclear test plan. North Korea announced last month it would conduct a test to protest the toughened U.N. sanctions.

"At the start, China gave him a warm welcome and, I think, some aid. But we got no gratitude. They take us for granted," said Jin Canrong, an international affairs expert at Renmin University in Beijing. "China tried to get closer to him, but it was not successful. China has become very disappointed."

Story continues

Yet Beijing also sees Pyongyang as a crucial buffer against U.S. troops based in South Korea and Japan. It also deeply fears a regime collapse could send swarms of refugees across its border. For those reasons, Beijing is unlikely to cut Pyongyang adrift, even if it pushes North Korea harder to end its nuclear provocations and reform its broken-down economy.

"China's not ready to turn the support to North Korea switch to 'off' at this stage," said Roger Cavazos, a North Korea watcher at the Nautilus Institute for Security and Sustainability.

North Korea's apparent reluctance to reform its economy ranks among Beijing's biggest frustrations, and the thorny nature of the bilateral relationship is on show along the frigid Yalu River, which forms part of the border Chinese troops crossed to rescue North Korean forces during the 1950-53 Korean War.

Last week, ahead of the Lunar New Year holiday, dozens of North Korean trucks lined up at a customs checkpoint in the northeastern Chinese border city of Dandong, loaded with bags of rice, cooking oil, cheap electronics and other daily items that their country's collapsed industry cannot produce enough of for its 24 million people.

Further to the south, a much-heralded North Korean economic zone on a pair of islands along the Yalu remains a field of untrammeled snow behind a newly erected border fence, more than 18 months after it was opened with great fanfare.

The Hwanggumphyong and Wihwa islands zone, one of two such establishments along the border, resulted from talks led by Chinese Commerce Minister Chen Deming and Jang Song Thaek, Kim's uncle and a top official in the ruling Korean Workers' Party who is thought to be pro-China. The two men attended the June 2011 grand opening accompanied by a brass band and the celebratory release of doves, giving rise to hopes that China's advice was having an impact on the North.

Yet area residents say they've seen no progress since then, while work on a towering bridge nearby, intended to supplement the rickety old one in Dandong, has slowed to a snail's pace. Dandong's city government has moved offices to the area, but the thickets of surrounding high-rise buildings remain unfinished and empty.

While Kim has made improving the economy a hallmark of his nascent rule, many analysts doubt that he will go too far with reforms for fear that change could lead to a loss of control, in turn threatening his authoritarian rule.

"There's nothing going on around here. North Korea is fine with taking Chinese aid and doing some trade, but its economy doesn't seem to be changing at all," said a Dandong businessman who trades with North Korea AND asked to be identified only by his surname, Qu.

That leaves the new fence as the dominant feature along the border. Topped with rolls of barbed wire, it doubles up in places to form both an inner and an outer perimeter, with a strip of concrete in between for guards to patrol along.

The intimidating barrier seeks to block the flow of illegal border crossers, typically those seeking food and work in China or an escape route to South Korea. It also symbolizes China's fears of instability in North Korea, a steel barrier to contain the chaos.

China is widely credited with keeping its neighbor afloat, providing an estimated half million tons of oil to North Korea a year, along with copious amounts of food aid. Officially tolerated smuggling buttresses the formal trade between them, while North Korea earns much-needed hard currency from thousands of North Koreans who work in northeast China and a similar number of Chinese tourists and advisers visiting the other side. Chinese companies are also investing in North Korea's mines, although many complain of corruption and a lack of respect for contracts.

Yet it remains unclear how much influence China has with North Korea. Despite Beijing's entreaties, Pyongyang has refused to return to Chinese-hosted six-nation nuclear disarmament talks that had won China credit as a responsible international power.

In a sign of China's rising pique, the Foreign Ministry recently took an unusual swipe at North Korea for spending on defense, rocket and nuclear programs instead of the economy. "We would also like to actively encourage the relevant country to develop economy and improve people's living conditions," Foreign Ministry spokesman Hong Lei told reporters late last month.

Chinese media have also been running commentaries suggesting Chinese interests need not be held hostage by its desire for a stable North Korea.

"If North Korea ignores the persuasion and eventually carries out a third nuclear bomb test, it must pay a heavy price for it. The various kinds of aid it receives from China will be decreased for good reasons. Of this, we hope the Chinese government will warn North Korea in advance, so that they will not have other fantasies," the Global Times, a nationalist tabloid that often airs controversial views, said in a commentary last week.

The latest test may not be enough to push the new leadership into casting North Korea adrift, but China may employ tougher measures, given that it has already upped the ante by agreeing to the tightened U.N. sanctions. If it does, North Korea can't say it wasn't warned.

___

Associated Press writer Charles Hutzler and researcher Yu Bing contributed to this report from Beijing.