In claiming that Nazanin Zaghari-Ratcliffe was “teaching journalists” in Iran, Boris Johnson has made a serious blunder: one that simultaneously harms the prospects of her release and diminishes the credibility of the Foreign Office. Yet perhaps the only truly surprising thing about the Foreign Secretary’s disastrous ‘diplomatic intervention’ is that it may, in the end, cause him real damage.

Johnson’s 30-year political and journalistic career has been characterised by poor judgment – often to the point of scandal. He has described African “piccaninnies” with “watermelon smiles” and linked Papua New Guinea to “cannibalism and chief-killing”. In a single paragraph published in the wake of Ken Bigley’s beheading, he chastised Liverpudlians for “seeing themselves as victims” and perpetuated ugly myths about the 1989 Hillsborough Disaster.

Somehow, consequences have been few and far between. Where indiscretion has ended other careers, Johnson’s political star has largely risen and his public image has remained largely unblemished. And the reason why he’s gotten away with it for so long is the same reason that his stock has been steadily falling since the Brexit vote: he’s a master at the dark arts of media relations – at the expense of pretty much everything else.

The Foreign Secretary has a long history of using language to attract positive attention and deflect negative press. As Martin Fletcher points out in his comprehensive New Statesman profile, this dates back to his time as Brussels correspondent for The Daily Telegraph – where, among other things, he published outrageous stories that the EU was planning to ban prawn cocktail crisps and blow up its Berlaymont HQ in a controlled explosion.

Liam Fox says we shouldn't overreact after Boris Johnson's Nazanin Zaghari-Ratcliffe gaffe

That these stories weren’t especially accurate didn’t harm him. Like any half-competent PR flak, Johnson understands how outlandish phrasing can bolster spurious stories and distract attention from unflattering ones. The classic example is his affair with Petronella Wyatt: instead of issuing a flat denial, he called it an “inverted pyramid of piffle.” This beautifully crafted quotation, rather than the indiscretion, is what people remember of a scandal that might have derailed any other political career: it is cited in The Wit and Wisdom of Boris Johnson and makes no. 7 in The New Yorker’s list of “Great Moments in Boris”. A list which, by its very existence, serves as a kind of totem to the “cult of Boris”.

This carefully-constructed image as a hilarious, loquacious, and essentially benign buffoon has served him well, and made him an appealing character to tabloid and broadsheet journalists alike. That he had personal connections at several major newspapers certainly didn’t hurt: The Evening Standard endorsed Johnson for Mayor of London in 2008 and 2012 – the editors on both occasions being ex-Telegraph colleagues and friends – and his former employers at The Spectator and The Daily Telegraph have written admiring editorials, with the latter being described as “Pravda for Boris Johnson”.

His efforts to cultivate this public image were historically successful and endeared him to much of the mainstream media. Euphemistic, distracting language, ridiculous imagery, and a knack for the attention-grabbing statement created a cult of personality – one that masked an absence of political achievement. When people thought of Boris Johnson, they thought of the zipwire incident and Have I Got News for You: the sex scandals, the racist outbursts, the aborted white elephant projects meant nothing. Carelessness was, if not a virtue, then certainly part of his charm.

But if a Mayor of London and backbench MP can get by on image, a Foreign Secretary – usually a dry, managerial type in the style of Philip Hammond or David Miliband – can’t. In a role that requires sensitivity and political acumen, he has floundered at every turn: YouGov’s “What the World” thinks poll has him at-38 favorability, and his majority was halved at the most recent general election.

He has not directed the same energy towards courting parliamentary allies as he did towards (literally) courting allies in the media, and he is suffering for it. The most important functions of his office – handling Brexit and negotiating trade deals – have been handed to the Department for Exiting the EU and the Department for International Trade. The ridiculous pronouncements and misstatements that made his career have finally begun to hurt him: as Foreign Secretary, his words matter, and it is no surprise that they have started to receive the wrong kind of attention.

Media savvy and a carefully-crafted “toff-about-town” public image may have created Boris Johnson, but it has not compensated for an absence of political nous or personal integrity. Ambitious politicians should treat him as a cautionary tale – and proof positive that an ability to grab headlines can be a blessing or a curse.