Analysis The firing of FBI Director James Comey came as a shock to almost everyone, not least to the man himself.
Comey was addressing FBI students in Los Angeles when the television behind him flashed up the news of President Trump's decision to give him his marching papers. Comey reportedly saw this and laughed, congratulating his audience on pulling off a clever prank, before his staff broke the bad news.
The move has ignited a political firestorm on both the left and the right, and Comey has found some very unlikely supporters on both sides of the fence. Most surprising of all was the statement from the Electronic Frontier Foundation.
"We have deep concerns about President Trump's firing of FBI Director James Comey. We disagreed with the director on many issues, including his consistent push for backdoors into our electronic communications and devices and a general weakening of encryption, which is crucial to protecting Americans' privacy and security," said Dave Green, the EFF's director of civil liberties.
"But we are deeply troubled about Director Comey's termination and what it says about the independence of the office and its ability to conduct fair investigations, including into threats to our digital security and the integrity of our elections."
Green's being polite; Comey's name was largely dirt at the EFF. The former director's continuing efforts to institute backdoor encryption systems (or front door them as he liked to call it) infuriated those people who know a thing or six about encryption.
It wasn't always that way. When Comey assumed office, he tried to reassure the technology community, saying that "security has promoted liberty, there's not a tradeoff." However, that soon went out the window.
The worm turns
Within months, Comey had begun his crusade against encryption, blaming Apple for introducing full-disk encryption and using his long-repeated line that the police were stymied by criminals' communications "going dark" for the Feds.
What spurred this move towards full-disk encryption was the government's own actions. After Edward Snowden's revelations about the extent of government surveillance, people got a lot more demanding about encryption. Apple's decision was both an excellent marketing move and was born of Cupertino's concerns on the topic.
Ironically enough, Comey actually tried to oppose the NSA's bulk surveillance practices when he was Deputy Attorney General during the GW Bush administration. While some Republican appointees – notably the torture-supporting White House counsel Alberto Gonzales – supported mass surveillance, Comey actively fought against it, according to people at the time.
However when he got to the FBI and saw how tough encryption was making things for his staff, Comey began to play hardball. This culminated in the legal case against Apple over the encryption on the San Bernardino terrorist's remaining iPhone.
The shooter destroyed all of his computers and all but one of his mobile phones, leaving his work phone untouched. The FBI took Apple to court to make them build a version of their operating system that could be cracked by the cops, after the FBI bungled the original examination of the device.
Apple won that one and Comey appeared to back down for a while. He declared a moratorium, saying he'd wait until after the election and then have an "adult conversation," about the matter – a phrase that riled up Reg writers.
Hackers harshing his buzz
Another of Comey's preoccupations was the need to recruit more talent to the FBI's computing teams.
The director was frustrated with the lack of qualified applicants looking to join the side of law and order, and constantly moaned that people weren't willing to serve in the agency. A Department of Justice report in 2015 found that staffing levels in the cybercrime division were 38 per cent down on what they should be.
Comey repeatedly whined that they couldn't find hackers who had the skills, physical fitness, and drug-free status that the FBI needs for its agents. To illustrate this, he made frequent allusions to people turning up to interviews stoned.
In fact, the reason the FBI has trouble hiring cyber-Sherlocks is its employment practices. In order to join the Fed's hacking squad, recruits have to go through the full FBI agent training in firearms, operational practices, physical fitness and case law. Only then can they get to work.
That's not an attractive option for a computer security specialist, particularly with high-paying jobs aplenty in private industry where your boss wouldn't care too much if you had long hair or piercings, and wouldn't have an overly rigid view about people getting into work at 0800 sharp, so long as the work gets done.
And yes, many hackers enjoy a doobie once in a while (although LSD microdosing is apparently this year's thing). But Comey's constant harping on the topic pissed off a fair few people. At last year's DEF CON, several hackers resented the insinuation that computer jocks are automatically druggies, which didn't help Comey's cause.
The FBI was originally the hero of the Republicans when it began a protracted investigation into Hillary Clinton's infamous home web server. There was a steady drip of information from the investigation that was a constant thorn in Clinton's side, much to Donald Trump's delight.
It was also Comey's undoing. His announcement on July 5, 2016 that he wasn't going to recommend prosecution caused an immediate flip-flop by Trump. The director was reviled for his lack of action and it was this decision that was ultimately named as the reason for his dismissal on Tuesday.
He was back in favor in October when he reopened the investigation into Hillary's emails, just 11 days before voters were due to go to the polls. The reason was an FBI investigation into disgraced ex-politician Anthony Weiner, who was married to top Clinton aide Huma Abedin.
The aptly-named Weiner had lost his political career over sexting pictures of himself to women other than his wife, which cost him his seat in the House of Representatives, his bid to become mayor of New York, and ultimately his marriage. He was also accused of similar habits with a 15 year-old girl, and the FBI was concerned that his laptop contained Clinton emails forwarded by his wife.
With the announcement that the investigation was restarting, Republicans were ecstatic. Trump said the decision showed "guts," while Democrats were driven to spittle-flecked rage at what was seen as a politically motivated announcement. Comey had been a registered Republican – he cancelled that affiliation when he got the top job at the FBI.
As it turned out, there were only a handful of emails that were forwarded through to Weiner's laptop, although it took the FBI far too long to sort that out. Clinton was once again in the clear, but she had taken a hit in the polls that some Democrats blamed for her losing the election – although running one of the most unlikeable and flawed candidates in the party's history coupled with pathetic campaigning in key states surely had more to do with it.
After the election Comey looked golden, and appeared to enjoy a good relationship with Donald Trump. Democrats still cried foul, however with Trump getting his feet under the table in the White House, there was little that could be done.