The power of magical thinking – the notion that you can make something happen merely by thinking about it – has been much in evidence in the current election campaign. And that’s not entirely surprising, because as politicians get desperate, rationality goes out of the window. What is surprising, however, is when high government officials – for example, heads of intelligence and law-enforcement agencies – begin to show clear signs of the syndrome.

Exhibit A in this respect is James Comey, the current director of the FBI. Mr Comey has become so exercised by the decisions of Apple and Google to implement strong encryption in their devices and services that he appears to have lost his marbles. “I am a huge believer in the rule of law,” he told reporters last September, “but I am also a believer that no one in this country is above the law. What concerns me about this is companies marketing something expressly to allow people to place themselves above the law.”

It’s good to know that the FBI director believes that nobody should be above the law. Except, of course, for his colleague, the former NSA director, James Clapper, who lied under oath to the US Congress about the existence of bulk data collection programs and yet remains at large. But we will let that pass: after all, as Oscar Wilde observed, consistency is the last refuge of the unimaginative, and Mr Comey is nothing if not imaginative.

We're drifting to a place where a whole lot of people are going to look at us with tears in their eyes

Take, for instance, his testimony to Congress in March in which he beseeched politicians to pass legislation that would prevent American citizens from communicating securely. The use of encrypted phones and computers, he burbled, presented “an affront to the rule of law”. He went on to paint an apocalyptic picture of what would happen if the technology isn’t banned. “We’re drifting to a place,” he told the House Appropriations Committee, “where a whole lot of people are going to look at us with tears in their eyes” as he described a hypothetical case in which a kidnapped young girl’s phone is discovered but can’t be unlocked.

The assembled lawmakers strangely omitted to draw attention to an intriguing inconsistency in his position on these matters. A while back, visitors to the helpful FBI security warnings site received the following advice. “When purchasing a smartphone, know the features of the device, including the default settings. Turn off features of the device not needed to minimise the attack surface of the device. Depending on the type of phone, the operating system may have encryption available. This can be used to protect the user’s personal data in the case of loss or theft.”

All excellent advice. But here’s the interesting thing: this advice has disappeared from the FBI site since Mr Comey started fulminating about encryption. The only reason we know that is because the wonderful Internet Archive had archived a copy of the relevant page.

So once upon a time, according to the FBI, encryption of your phone was a really good idea; and then, suddenly, it becomes an affront to the rule of law. Why the difference? Answer: Edward Snowden. The new encryption facilities installed by Apple and Google were a direct response to his revelations. The companies feared a backlash from users if they did not take stronger measures to protect their privacy. So they did, which is why, for example, Apple’s iMessage and Facetime communications are encrypted end-to-end and Apple has no way to decrypt those messages when they’re in transit.

This is what enrages Mr Comey and his NSA buddies. But they are caught in a bind: on the one hand they know that strong encryption of communications is a good idea in general; on the other, they want to ensure that they can access those communications whenever they want to. Their proposed “solution” is for back doors, for use by law-enforcement and intelligence agencies, to be inserted into encryption technologies. In other words, they want breakable non-breakable encryption.

Which is where magical thinking comes in. An encryption system that has a deliberate vulnerability built in (because that’s what a backdoor is) is not going to provide strong encryption. So for the moment it belongs in the same category as flying cars and perpetual-motion machines. And we’re not going to have those any time soon either. Mr Comey needs to calm down and do some real thinking.