BEIJING — China said Monday that President Donald Trump’s threat to cut off trade with countries that deal with North Korea is unacceptable and unfair.

Trump had said on Twitter on Sunday the United States is considering halting trade with “any country doing business with North Korea.” His remarks came after North Korea detonated a thermonuclear device in its sixth and most powerful nuclear test.

They were seen as a veiled warning to China, the North’s closest ally and commercial partner.

China regarded as “unacceptable a situation in which on the one hand, we work to resolve this issue peacefully, but on the other hand, our own interests are subject to sanctions and jeopardized,” said Geng Shuang, a Chinese Foreign Ministry spokesman, at a briefing in Beijing on Monday.

“This is neither objective nor fair,” Geng said.

Trump said that the approach was under consideration, “in addition to other options.” But such a halt would be radical — the U.S. imports about $40 billion in goods a month from China.