WASHINGTON — While the world agonized over the huge nuclear test in North Korea this weekend, President Trump aimed his most pointed rhetorical fire not at the renegade regime in Pyongyang, but at America’s closest partner in confronting the crisis: South Korea.

In taking to Twitter to accuse Seoul of “appeasement,” Mr. Trump was venting his frustration at a new liberal South Korean government he sees as both soft on North Korea’s atomic program and resistant to his demand for an overhaul of trade practices that he views as cheating American workers and companies.

For Mr. Trump, the crisis lays bare how his trade agenda — the bedrock of his economic populist campaign in 2016 — is increasingly at odds with the security agenda he has pursued as president. It is largely a problem of Mr. Trump’s own making. Unlike several of his predecessors, who were able to press countries on trade issues while cooperating with them on security, Mr. Trump has explicitly linked the two, painting himself into a corner.

The president, known for fighting his political wars simultaneously on multiple fronts, seems intent on taking on all comers in Asia. The president on Sunday took a somewhat milder jab at another country he sees as an adversary on trade, China, saying the North was an “embarrassment” to Beijing, its primary economic patron.