“South and North Korea confirmed the common goal of realizing, through complete denuclearization, a nuclear-free Korean Peninsula,” North Korea’s Kim Jong-un and South Korean President Moon Jae-in said in a joint statement.

The president took a deserved victory lap on Twitter:

KOREAN WAR TO END! The United States, and all of its GREAT people, should be very proud of what is now taking place in Korea! — Donald J. Trump (@realDonaldTrump) April 27, 2018

Trump’s strategy was a modern reinvention of Richard Nixon’s “madman” theory for dealing with the Soviet Union. And it was flamboyantly batty: Trump called Kim “Little Rocket Man” at the United Nations, threatened “fire and fury” against the North, and boasted about the comparative sizes of their nuclear buttons, as the North’s weapons capacity increased.

But unlike Nixon’s feint, Trump’s worked. The North agreed to talks ahead of the Olympics, welcomed then-CIA Director Mike Pompeo for secret talks, and is negotiating a summit meeting between Trump and Kim. Then came Friday’s meeting. The speed with which the shift has happened, after decades of stalemate, is a testament to the efficacy of Trump’s stratagem. Not only is there progress toward ending the war, but North Korea consented to language about a “nuclear-free Korean Peninsula.”

While Trump has tended to pick fights with allies, his work with China to pressure North Korea deserves particular notice. He cultivated Xi Jinping and persuaded China to use its muscle to further isolate North Korea and force it to the negotiating table. In what could be a sign of personal growth, Trump even managed to share the credit, without boasting, in another Friday tweet: “Please do not forget the great help that my good friend, President Xi of China, has given to the United States, particularly at the Border of North Korea. Without him it would have been a much longer, tougher, process!”

As Trump said on Fox and Friends on Thursday, a date and time for the Kim-Trump summit isn’t set yet, but negotiations are ongoing. That meeting can and should serve as the crowning moment of the process. The statement from the leaders on Friday leaves many details unresolved, but it is a huge step forward. Just a few months ago, many of foreign policy’s wise men and women were wringing their hands, afraid Trump would start a nuclear war. Instead, he has done what they couldn’t, and nearly achieved peace between the Koreas.

As a candidate, Donald Trump promised to bring a fresh approach to intractable foreign-policy problems. Rhetorically, that has been true, with the president offering threats and bluster. What is clear now, and was clear to many people then, was that Trump really had very little understanding of what he was talking about. On Friday, after a historic meeting between the leaders of North and South Korea, Trump tried to take a victory lap. In reality, he’s walking into an old North Korean trap, showing how little he knows.