The moment Damian McBride clicked the "send" button on a rushed email was the moment Gordon Brown was brought uncomfortably close to gutter politics.

The prime minister's adviser was replying to a request for help from his old colleague Derek Draper seeking material to post on a website Draper was considering setting up to air anonymous gossip about the Tories. Did McBride have any ideas? He certainly did.

As Draper, a former aide to Peter Mandelson, put it yesterday: "Some were in bad taste, though I have to admit some were also brilliant and rather funny." But even though they never saw the light of day, these mini-scandals have created a much larger one. The problem for Draper and McBride is that it is engulfing the man they were trying to support.

Just as Brown was basking in a rare upturn in the polls following Barack Obama's visit, he has been derailed. And the scandal lapped closer to him last night as it became clear the emails were copied to Charlie Whelan, now a senior union official but another former Brown aide who remains close to the prime minister.

McBride, a football-loving and pugnacious former Treasury civil servant drawn into Brown's inner circle, paid yesterday with his career. Draper, who is not a party employee, will still run his LabourList blog but is likely to find himself cold-shouldered by Labour colleagues.

This is his second major brush with controversy: after the last, when, while working as a lobbyist, he boasted to an undercover Observer reporter about how "intimate" he was with key New Labour figures, he abandoned politics to train as a psychotherapist. He married the GMTV presenter Kate Garraway and disappeared from Westminster.

But then shortly after Mandelson returned to the Cabinet, Draper re-emerged to set up LabourList. The emails show how quickly he had settled back into his old network.

If the prime minister was unaware of this muckraking, the Tories say, he should have known; and it reflects badly on the culture of his administration that his aides thought such practices acceptable - particularly as they involved MPs' families.

"It's not just about me: it's my daughters at school, it's my parents, it's the embarrassment of everyone else involved," says Nadine Dorries, a Tory backbencher, the victim of allegations she says are utterly untrue.

Smears are, of course, a staple of politics not confined to any one party, but the charge against McBride and Draper is not just one of dirty tricks but of hamfisted meddling in a new media world they did not properly understand.

The vendetta between senior Brownites and Guido Fawkes, the Westminster blogger who obtained the emails, dates back to stories Fawkes - whose real name is Paul Staines - posted about the Smith Institute and its relationship to Ed Balls, also a close friend of McBride.

Shortly afterwards journalists began being offered snippets designed to undermine Staines, including news of his drink-driving conviction. Coincidence? Staines, say friends, does not think so. His blog continued targeting senior Labour figures, and its waspish attacks got under Labour's skin. When Draper launched LabourList, it was not long before they crossed swords - with Staines questioning Draper's qualifications as a therapist and Draper threatened to sue.

Draper also clashed with Iain Dale, accusing the Tory blogger of being a racist over comments he made defending Carol Thatcher. Both Tory bloggers suspected McBride was guiding the attacks on them - a suspicion understood to be confirmed in the emails.

The standoff culminated in a picture of McBride posted last Thursday, with the red crosshairs of a rifle sight superimposed on his head and no further explanation. A day later, the Telegraph ran a front page story on the leaked emails, but without revealing their contents. Was the story released by Labour in a desperate bid to spoil a scoop being prepared by the Sunday papers?

But yesterday, as senior Labour as well as Tory figures demanded his head, it was clear McBride could not survive. Losing him will have been painful for Brown: but when he warned last night that such tactics had no place in politics, it became clear he was using his loyal aide's departure to distance himself from a toxic episode. If he cannot do so, then the scandal is far from over.