President Donald Trump on Saturday seemed to hint at action against North Korea, saying that “only one thing will work” to rein in the country’s nuclear ambitions.

The comment followed a suggestion by Mr. Trump on Thursday night that a dinner he was attending with military leaders might represent “the calm before the storm.” He didn’t elaborate on the remark.

“Presidents and their administrations have been talking to North Korea for 25 years, agreements made and massive amounts of money paid,” Mr. Trump said on Twitter on Saturday afternoon. “Hasn’t worked, agreements violated before the ink was dry, makings fools of U.S. negotiators.”

“Sorry, but only one thing will work!” he added.

The White House declined to answer a question about what action Mr. Trump was referencing.