Kim Jong-un’s dramatic entrance into China by train – his first foreign trip as North Korean leader – reinforced his current message of engagement. It also marked a new step in the bilateral alliance. But in what direction? Information from the North, especially, is so tightly controlled that his visit was only confirmed once it was over. Experts must squint between the lines of the official statements.

The alliance, always fraught, has deteriorated since Mr Kim took power. Chinese state media stressed the amity, but described an “unusual” relationship. One reason is that there are three of them in it, so it is a little bit crowded. Mr Kim’s father and grandfather were regular visitors to Beijing. His decision to go there only now, more than six years after taking power, clearly relates to his pending meeting with Donald Trump, due to take place by May. Beijing, Pyongyang and Washington are trapped in a bizarre triangle, with no love lost: only suspicion and a great deal at stake.

North Korea needs China’s food and energy, but chafes at its subordinate position, and has long sought direct talks with the US. Winning those gives Mr Kim the chance to rebalance relations with China. But meeting Xi Jinping first reassured Beijing that he is not cutting it out. It strengthens him as he approaches the meeting, and offers insurance should talks go badly.

Meanwhile, China doesn’t want to be sidelined. This trip has reinserted Beijing into proceedings dominated by Seoul, Pyongyang and Washington, and reasserted Mr Xi’s status. The White House was briefed on the trip only after the North Korean leader had left. An additional benefit for Beijing may be extra leverage with the US as Mr Trump slaps on trade sanctions.

Beijing doesn’t like the North’s nuclear programme – not least because it encourages military build-up in the region – but its desired outcomes are very different from America’s. It certainly doesn’t want a highly risky US military attack on its doorstep. It assumes talk of such action is intended to strong-arm Beijing into piling pressure on the North. But who can count on that with Mr Trump in power – and advised by figures such as John Bolton, who never met a war he didn’t like?

In turn, the US sees China as key to making North Korea behave itself (only partially true, since Beijing has a hammer, not a lever: it could cause the North’s collapse; it cannot tweak its policy). But if it can get there without offering China a quid pro quo, all the better. And Mr Trump would love to make these talks his personal victory.

The danger is that they could be a disaster. Negotiations with North Korea demand skill, patience and coordination. Mr Trump is a volatile, egotistic unilateralist marching in with a side largely shorn of expertise. When North Korea talks of denuclearisation, it does not mean what he thinks it does. There are fears that he might make critical concessions over the heads of advisers and allies – and equally that he could dismiss these talks too quickly, and warn that the only option left is force.

What Mr Kim and Mr Xi discussed this week remains a mystery, beyond its crudest outlines. Did China agree to dial down the pressure? How closely did they coordinate over the approaching summit? But opacity fogs the vision of the players as well as that of their audience. Each side has at best partial knowledge of the rival interests, priorities and tactics. And if Mr Trump and Mr Kim meet as planned, ignorance and misapprehensions could have truly frightening consequences.