China is complaining about new US sanctions that target Chinese companies and individuals for their continued ties with North Korea — and effectively siding with Pyongyang in the process.

On Tuesday, the US Treasury Department slapped economic restrictions on 10 companies and six individuals from China and Russia. The measures are aimed at stopping those people and businesses from trading with North Korea, which funnels the money it receives from exports to its nuclear and missile programs. “Treasury will continue to increase pressure on North Korea by targeting those who support the advancement of nuclear and ballistic missile programs,” Treasury Secretary Steven Mnuchin said in a press release.

China immediately responded with an angry statement. “Measures taken by the United States are not helpful in solving the problem,” government spokesperson Hua Chunying said at a recent news conference. “We ask the United States to stop the relevant wrong practices immediately.”

But by defending itself, China is also shielding North Korea. The new US sanctions intend to hurt both Beijing and Pyongyang — even if the Chinese government doesn’t officially see it that way.

It’s worth pointing out that China has taken some steps to punish North Korea. Vox’s Zeeshan Aleem reported that China stopped seafood imports from North Korea in compliance with UN sanctions the Chinese voted in favor of earlier this month. That will cause some damage as North Korea relies on China for around 90 percent of its trade. But experts told Aleem they were skeptical China would stay the course.

So these sanctions are a message for Beijing to get serious about leaning on North Korea — and soon. “The Chinese should not be surprised that Trump’s patience is limited,” said Bonnie Glaser, a China expert at the Center for Strategic and International Studies think tank.

The US is trying to get more out of China

President Trump hoped earlier this year that China would help curb North Korea’s aggressive behavior. At one point he even praised Beijing for its efforts, tweeting, “At least I know China tried!”

While I greatly appreciate the efforts of President Xi & China to help with North Korea, it has not worked out. At least I know China tried! — Donald J. Trump (@realDonaldTrump) June 20, 2017

But on June 29 — only nine days after that friendly message — the US placed sanctions on a Chinese bank, a Chinese company, and two Chinese individuals because of their North Korea ties.

Trump continued the more adversarial stance toward China on July 29. “I am very disappointed in China,” he wrote in the first of two tweets. “China could easily solve this problem!” he concluded in the second post.

Yet Kim Jong Un continued to test missiles, including two in July that can theoretically hit most of America. North Korea even threatened to launch four smaller projectiles at Guam during an escalatory war of words with the United States this month that led Trump to say he would unleash “fire and fury” on Kim’s regime.

But rhetoric aside, the Trump administration doesn’t want to go to war with North Korea. China doesn’t want that either, as a war between the US and North Korea would destabilize the Korean Peninsula, sending millions of refugees flocking northward toward China.

So the US and China share a mutual interest in solving the North Korean problem peacefully. But Ely Ratner, a former Obama administration official and China expert at the Council on Foreign Relations, believes China won’t act in a meaningful way without additional sanctions. “It’s a necessary component of any pressure strategy on North Korea.”