John Bolton is not well-liked in Washington. A warmonger and bully, the national-security adviser is disdainful of the bipartisan foreign-policy world and the governing institutions its members cycle in and out of. That he oversees one of them is typical of the plate-smashing Trump administration.

Few doubt, however, that Bolton is a wily operator. As President Donald Trump’s third national-security adviser — and the first with previous experience of civilian bureaucracy — he already has demonstrated his mastery of the inter-agency policy process. His role in derailing, at least temporarily, Trump’s planned meeting with Korean dictator Kim Jong Un in Singapore therefore demands scrutiny.

Bolton suggested that the “Libya model” was what America wanted from North Korea. That was not illogical: Trump had demanded that Kim take the same step as Libyan dictator Muammar Qaddafi in 2003, carrying out denuclearization in return for sanctions relief.

Nonetheless, the fact that Qaddafi later was bombed from power by a NATO intervention, dragged from his hiding place by insurgents, sodomized with a bayonet and shot dead, made Bolton’s choice of precedent complicated. The Libya model is what Kim fears most. It is prime evidence for the theory that has underpinned his regime’s nuclear program, to the North Korean people’s cost, for five decades: Possession of nuclear weapons equals regime survival, so disarmament equals regime endangerment.

The North Korean smackdown to Bolton (“We do not hide our feelings of repugnance toward him”) was predictable. Then, however, Trump blundered in. Wrongly assuming that Bolton had referred to the American-led bombing of Libya, not to the disarmament that preceded it, he said it didn’t sound like what he had in mind for Kim. But then he added that, yes, now you come to mention it, if the North Korean despot wouldn’t make a deal in Singapore, his regime would “most likely” have to be “decimated.” When Vice President Mike Pence parroted that threat, the North Koreans called him “ignorant and stupid” and threatened a nuclear war.

Bolton went to see Trump about that. The president called off the summit soon after. Bolton, who doubts it is worth negotiating with Kim and long has advocated toppling his regime, may not be displeased with that outcome.

At the least, he clearly intended to add a harder edge to Trump’s newfound enthusiasm for the “honorable” Kim. In the absence of many other moderating influences on Trump, whose confidence in his ability to direct global affairs appears to be growing by the day, this suggests that Bolton could play a more positive role than his many critics have countenanced.

They fear he may lead Trump into a catastrophic conflict, which is a valid concern. Yet it seems likelier that Bolton’s skepticism about diplomacy, his apparent good standing with the president and his willingness to speak truth to power could mitigate a more pressing risk: that the president will expend a rare moment of American leverage with Kim on a hasty, ill-considered deal that could leave eastern Asia even more insecure than it is now.

“There’s a synergy between Trump’s desire for a deal and Bolton’s ideological prejudices,” said Jeffrey Bader, an east-Asia guru and former diplomat.

This apparent turnaround in Bolton’s role reflects a more dramatic change in Trump. The president spent much of last year threatening Kim with “fire and fury.” By demanding an array of military options against North Korea, he also suggested that he was in earnest. His appointment of the bellicose Bolton, to replace H.R. McMaster, reinforced that impression.

If this scared the Washington crowd, it appears to have terrified Kim, as well as China and South Korea, both of which fear a war on the peninsula more than they fear North Korea’s nuclear arsenal. With their support, Trump imposed the toughest sanctions regime on North Korea in more than a decade, a substantial achievement.

However, the alacrity with which since then he has melted in the face of Kim’s request for talks has made his war talk seem less credible. Arguably, it has exposed Trump as the actor/politician — with a penchant for talking tough, a lifelong aversion to costly wars and no fixed purpose beyond concern for his own interests — that he always was.

It is hard to see the sanctions regime surviving that realization intact, because China and South Korea already are itching to restore their economic ties to North Korea. This may help explain why Trump, notwithstanding the Bolton-instigated hiatus, seems keener for a deal with Kim than ever.

It also underlines another misconception about Trump’s foreign policy. Relentless media attention to his team, including Bolton, is based on an assumption that he would be more easily influenced than he has turned out to be. The president likes to hear diverse opinions — hence his desire for a fire-eater like Bolton, a type of adviser he lacked. However, he has made the big foreign-policy calls himself, often, as in his swift acceptance of Kim’s invitation, on his own initiative and in the high-rolling way he ran his business.

This is why it seems likely that the summit with Kim will be revived and that some sort of deal, or semblance of a deal, will result: Trump wants that. In turn, this is why Bolton’s ideological obduracy looks less risky than welcome.

The deal, if it comes, is unlikely to contain much detail. The task of filling in the gaps — on how Kim’s commitment to a phased denuclearization might be verified, for example, or on whether his short-range missiles could be included in it — would fall to Secretary of State Mike Pompeo and to Bolton. It would be a perilous undertaking, requiring them to deal not only with North Korea, but also with Trump’s desire to be seen to have delivered world peace. A suspicion that Pompeo is unduly keen to stay tight with the president suggests that only Bolton might be up to it.

For such a Washington bogeyman to play that heroic role would be extraordinary. Then again, who could have predicted Trump negotiating with Kim?