As it turned out, it was more than a photo op. Donald Trump not only shook hands again with Kim Jong-un and became the first incumbent US president to enter North Korea but also, instead of the expected exchange of pleasantries, sat down with his counterpart and talked for an hour in the demilitarised zone (DMZ) between the Koreas. And there was a tangible outcome.

Meetings between US and North Korean working groups will restart four months after they broke down at the Hanoi summit in February. Real negotiations are back on. The question, as ever, is whether they will lead anywhere.

There is no question that Trump’s motives for calling the meeting, at a day’s notice, were primarily electoral. Throughout the day, Trump grumbled repeatedly about how he had not been given enough credit from the press for defusing tensions on the Korean peninsula.

Donald Trump invites Kim Jong-un to US after entering North Korea Read more

His own narrative cut a few corners to say the least, omitting to mention that the most dangerous moments – North Korea’s test of a hydrogen bomb and intercontinental ballistic missiles, and his own threats of “fire and fury” – all happened in his first year in office. He insisted that all North Korean nuclear and ballistic missile tests had ceased, by declaring that the short-range solid-fuel missile tests in May were not actually tests. He did not explain.

The DMZ meeting was all about shaping a narrative. That is why John Bolton, the ultra-hawkish national security adviser, was nowhere to be seen; he had been sent, or sent himself, to Ulaanbaatar, Mongolia. But the official US party included Tucker Carlson, a Fox News talkshow host, who is Trump’s principal channel to the non-interventionist section of his far-right base. Eleventh-hour conversations with Carlson reportedly persuaded Trump not to launch missiles against Iran this month, after the downing of a US drone.

The fact that the meeting on Sunday with Kim was more than perfunctory suggests that Trump, for all his bluster, is aware that a mere photo op could not guarantee his image as master dealmaker all the way up to the November 2020 presidential election. There had to be some substance, and that would require repairing the damage done in Hanoi.

The summit in the Vietnamese capital broke down because the working group talks in the run-up had led Kim – and most observers – to believe the US was open to a step-by-step plan, in which North Korea would dismantle some of its extensive nuclear programme, part of the complex in Yongbyon, for example, in return for relaxing sanctions.

On the first evening of the Hanoi summit, however, Trump took Kim by surprise by presenting a comprehensive, all-for-all, proposal, advocated by Bolton and the secretary of state, Mike Pompeo.

The gambit was a flop. Rather than discombobulating Kim into giving up concessions, the North Korean leader was spooked and dug in his heels the next morning. The parties packed their bags early, leaving a ceremonial lunch uneaten on the table.

Trump repeated on Sunday that he wanted a “comprehensive” deal, but also hinted heavily he was ready to go back to a phased approach, suggesting some sanctions could be lifted in the course of negotiations, not only at the end.

“At some point during the negotiation, things can happen,” Trump said after his meeting. “So we’ll be talking about sanctions.”

The man who will be leading the US team to the working groups talks will be Stephen Biegun, the same special envoy who was negotiating the step-by-step approach before Hanoi and Trump’s abrupt change of course. Trump said Kim was “putting somebody in charge [of the North Korean team] who we know and who we like”. But he did not say who that was.

No wonder Kim looked so much happier at the DMZ than in Hanoi. He achieved something his father and grandfather had dreamed of: an actual serving US president on North Korean territory – 20 metres of it, at least.

Trump declared it “an honour” and suggested Kim would be welcome in the White House. This has been the strategic goal of the regime all along, to gain international acceptance as a nuclear-armed state.

That strategy means that Kim has no intention of disarming, but he could accept limits on his arsenal – arms control rather than denuclearisation. That will be tough for Trump. It will involve climbing down from his Hanoi posture.

And such a deal would be demonstrably worse than the 2015 nuclear agreement with Iran, which Trump withdrew from and is trying to destroy. In that deal, Tehran is not allowed to get within a year of making a single nuclear weapon.

For such talks to succeed, Bolton might not only have to be excluded from the DMZ but from the White House, too. Far stranger things have happened in this administration and the fact that the president referred to his national security adviser more than once on Sunday as “Mike” Bolton may be a sign.

But if Trump does have second thoughts on doing a deal, Kim will know how to turn up the pressure: launch a missile during a campaign rally.

That will be the battle of wits in the next phase. For the time being, as Trump said when he thanked Kim for turning up at short notice and mugging for the jostling photographers around them: “You made us both look good.”