In a staggering turn of events, North Korea and South Korea look set to actually establish something close to real peace. Last week, Kim Jong Un became the first North Korean leader to step foot on South Korean soil, a remarkable moment captured on film. In talks Friday, both sides agreed to work on "denuclearizing" the peninsula and officially ending the Korean War. It's impossible to say exactly what's motivating this decision — we'll have to wait until personal testimony and perhaps historical archives can be examined.

But it's also impossible to overlook the presence of President Trump. By purest accident, his herky-jerky combination of extreme belligerence, laziness, and incompetence appears to have been a perfect diplomatic catalyst. One can only laugh.

To be clear, that is not to say Trump deserves much actual credit for this development. His major actions in this situation have been stoking panic from Seoul to Los Angeles with his furious, near-genocidal threats toward North Korea (and personal insults of its leader) and choosing the most bloodthirsty warmonger in the Republican Party to serve as national security adviser. That very easily could have turned into a world-historical bloodbath.

Some have argued that behaving like an erratic maniac is actually a strategic masterstroke — the "madman theory" of diplomacy. The idea is that if someone seems just crazy enough to start a war, the other side might capitulate (Nixon tried this in Vietnam and it didn't work). But there are several large problems with this argument. First is with the basic logic: If someone is crazy enough to start a war, then why should they be trusted to back down if you submit to their demands?

But more importantly, nobody has been convinced to give in to the United States. Instead, America has been pushed away from the center of events, as regional leaders have effectively concluded the U.S. is the biggest obstacle to peace. Even under President Obama, American power was a suffocating presence — made worse by the constant possibility that our unhinged domestic politics could break out and obliterate any diplomatic bargain we might make. A declining empire neurotically obsessed with demonstrating strength all across the globe can be dangerous indeed.

And once the most unhinged faction was in charge, Trump and his subordinates repeatedly implied that a cataclysmic war on the Korean peninsula — Seoul would be flattened in minutes — was a price worth paying for American "security." South Korean President Moon Jae-in seems to have concluded that he was more-or-less on his own, and made a break for peace.

Indeed, Trump's bluster has mainly served to convince all the major parties that they should basically ignore the United States, and seems to have opened a space for others. Aside from Moon, China and Kim Jong Un have also struck out in new directions, and deserve some secondary credit. China has been on the one hand tightening sanctions on North Korea in retaliation for their continuing nuclear testing, but on the other recently welcoming Kim with an official state visit, complete with all the lavish diplomatic pomp due to a normal head of state. The message seemed clear: If Kim shapes up, North Korea might patch up trade relations and get some critically needed raw materials and exports.

As these negotiations happen, China is watching from the sidelines, likely hoping that at least this longstanding conflict can be resolved without it having to deal with an expensive, destabilizing North Korean implosion.

And unbelievably, when Moon and Kim made their move towards peace at the Winter Olympics, Trump did a complete 180 and embraced it. He agreed to meet with Kim himself back in March, and then-CIA Director Mike Pompeo had a preliminary meeting on Easter weekend. The Trump-Kim meeting will surely be the key event determining if any sort of lasting deal can be achieved.

No doubt there are a lot of things that could go wrong in that meeting. But what Trump will want is a deal for which he can claim credit. He is ignorant and belligerent, but he always presents himself as a savvy dealmaker above all else. "Presiding" over a peace process that dissolves one of the thorniest geopolitical problems in the world — notably, one that Barack Obama was totally incapable of resolving — would be the sweetest imaginable nectar for Trump. The gloating will be off the charts. He's already taking credit:

Kim and Moon almost certainly realize that as well, and also that Trump won't be sweating the details. All they have to do is figure out a reasonable bargain, let Trump say and think that he's Mr. Negotiator Man, and hope that his ego is big enough to restrain the likes of John Bolton if and when he tries to blow up the deal.

A deal to end the war and relax sanctions in return for, say, Iran deal-style dismantling of nuclear weapons and inspections would be well worth doing. Opportunities to resolve half-century-old conflicts don't come along every day. Enduring a little (okay, a lot) of boasting from Trump would be a price worth paying.