YESTERDAY'S departure of Alan Johnson from the post of shadow chancellor was wholly unexpected. Today's resignation of Andy Coulson, Downing Street's director of communications and a hugely influential force in the government, has been coming for some time.

Mr Coulson's troubles date back to his time as editor of the News of the World. Under his watch, investigative reporters at the Sunday tabloid newspaper had been exposed using techniques such as the hacking of voicemail messages to unearth stories about celebrities, politicians and even Royalty. He resigned over the revelations in 2007, but denied (and continues to deny) having any knowledge or complicity in these illegal journalistic practices.

Many questioned the plausibility of those denials, and so suspicion has dogged him ever since. In December, the Crown Prosecution Service said that it did not have the evidence to pursue charges against Mr Coulson but pressure on him has barely relented. In short, he became the story, the cardinal sin for any spin doctor. "When the spokesman needs a spokesman, it is time to move on," his departing statement acknowledges.

The resignation of Mr Coulson is damaging for the government in two ways. First, the judgement of David Cameron, the prime minister, has been brought into serious question. He recruited Mr Coulson to head the Conservatives' media operation even after his ignominious departure from the News of the World. He continued to back him until the very end. Many doubt that Mr Cameron, deep down, really believed that Mr Coulson could have been entirely oblivious of widespread phone-hacking taking place under his nose, and that therefore he was choosing to employ someone he knew to have done wrong. The same critics say this is part of a broader pattern of Mr Cameron being willing to sup with the allegedly unscrupulous, pointing to his long-time association with Lord Ashcroft, a controversial Tory donor.

Secondly, Mr Coulson is very, very talented. Almost as soon as he joined the Tory operation in 2007, he expanded beyond mere media-management to exert huge influence on political strategy. He is, along with Steve Hilton (an increasingly bitter rival of late, and no doubt a quietly happy man today), Mr Cameron's closest backroom adviser. Of the coalition's frontline politicians, only George Osborne, the chancellor of the exchequer, and Mr Cameron himself can be safely said to have more of a say on the government's direction and day-to-day running. Mr Coulson's personal style is, ironically, very un-tabloid. He is quietly, politely effective, and surprisingly popular with ministers and civil servants as a result. Thanks to his humble roots in Essex, he also gave the privileged Mr Cameron a feel for what ordinary lower-to-middle income voters in unfashionable parts of the country were thinking. His direct line to the upper echelons of Rupert Murdoch's News Corporation empire, which owns some of Britain's most influential newspapers (including the News of the World), turned out to be less valued by the Tories than his general competence.

Finding another canny, tough, well-connected media man (or woman) to replace Mr Coulson will not be hard. Indeed, his replacement, whoever that turns out to be, may be an improvement in some respects: Mr Coulson never bothered to cultivate the commentariat, leading to a distinct dearth of pro-Cameron voices in Britain's opinion and editorial pages. Finding someone who is as good at politics as at the media game will be the real challenge for the prime minister, along with hanging on to his reputation as what a predecessor might have called a "pretty straight kind of guy".