BEIJING — China on Sunday expressed concern and what appeared to be veiled criticism of its longtime ally North Korea.

“No one should be allowed to throw a region and even the whole world into chaos for selfish gains,” Chinese President Xi Jinping said at an economic forum in Hainan province.

Avoiding mentioning North Korea by name, Xi said, “While pursuing its own interests, a country should accommodate the legitimate interests of others.”

China’s Foreign Ministry also issued a statement Sunday saying it was “seriously concerned” about the “continuously escalating tensions.”

The comments from China come on the heels of several days of escalating threats by North Korea against the United States and South Korea, including the possibility of nuclear attacks.

China — long seen as a key factor propping up the regime in Pyongyang — recently has shown signs of frustration after North Korea ignored its pleas not to carry out a recent nuclear test.

Chinese officials who value stability above all else are unlikely to abandon North Korea altogether in the near future. But sensing an opening amid Chinese frustrations, the Obama administration is trying to push Beijing to take a much stronger stance against the renegade country than it has in the past, U.S. officials have said in public and private comments.

“Clearly with the border they have, with the economic relationship that they have, they can do more,” Susan Rice, U.S. ambassador to the United Nations, said Friday at a women’s summit in New York.