My colleagues in the American liberal press had little to fear at the start of the week. Their charismatic candidate was ahead in virtually every poll. George W Bush was so unpopular that conservatives were scrambling around for reasons not to invite the Republican President to the Republican convention. Democrats had only to maintain their composure and the White House would be theirs. During the 1997 British general election, the late Lord Jenkins said that Tony Blair was like a man walking down a shiny corridor carrying a precious vase. He was the favourite and held his fate in his hands. If he could just reach the end of the hall without a slip, a Labour victory was assured. The same could have been said of the American Democrats last week. But instead of protecting their precious advantage, they succumbed to a spasm of hatred and threw the vase, the crockery, the cutlery and the kitchen sink at an obscure politician from Alaska.

For once, the postmodern theories so many of them were taught at university are a help to the rest of us. As a Christian, conservative anti-abortionist who proved her support for the Iraq War by sending her son to fight in it, Sarah Palin was 'the other' - the threatening alien presence they defined themselves against. They might have soberly examined her reputation as an opponent of political corruption to see if she was truly the reformer she claimed to be. They might have gently mocked her idiotic creationism, while carefully avoiding all discussion of the racist conspiracy theories of Barack Obama's church.

But instead of following a measured strategy, they went berserk. On the one hand, the media treated her as a sex object. The New York Times led the way in painting Palin as a glamour-puss in go-go boots you were more likely to find in an Anchorage lap-dancing club than the Alaska governor's office.

On the other, liberal journalists turned her family into an object of sexual disgust: inbred rednecks who had stumbled out of Deliverance. Palin was meant to be pretending that a handicapped baby girl was her child when really it was her wanton teenage daughter's. When that turned out to be a lie, the media replaced it with prurient coverage of her teenage daughter, who was, after all, pregnant, even though her mother was not going to do a quick handover at the maternity ward and act as if the child was hers.

Hatred is the most powerful emotion in politics. At present, American liberals are not fighting for an Obama presidency. I suspect that most have only the haziest idea of what it would mean for their country. The slogans that move their hearts and stir their souls are directed against their enemies: Bush, the neo-cons, the religious right.

In this, American liberals are no different from the politically committed the world over. David Cameron knew that he would never be Prime Minister until he had killed the urgent hatred of the Conservative party in liberal England. A measure of his success is that hardly anyone now is caught up by the once ubiquitous feeling that no compromise is too great if it stops the Tories regaining power. Hate can sell better than hope.

When a hate campaign goes wrong, however, disaster follows. And everything that could go wrong with the campaign against Palin did. American liberals forgot that the public did not know her. By the time she spoke at the Republican convention, journalists had so lowered expectations that a run-of-the-mill speech would have been enough to win the evening.

As it was, her family appeared on stage without a goitre or a club foot between them, and Palin made a fighting speech that appealed over the heads of reporters to the public we claim to represent. 'I'm not going to Washington to seek their good opinion,' she said as she deftly detached journalists from their readers and viewers. 'I'm going to Washington to serve the people of this country.'

English leftists made the same mistake of allowing their hatred to override their judgment after the Iraq war. If they had confined themselves to charging Tony Blair with failing to find the weapons of mass destruction he promised were in Iraq, and sending British troops into a quagmire, they might have forced him out. They were so consumed by loathing, however, they insisted that he had lied, which he clearly had not. They set the bar too low and Blair jumped it with ease. 'When a man believes that any stick will do, he at once picks up a boomerang,' said GK Chesterton, and when the politically committed go on a berserker you should listen for the sound of their own principles smacking them in the face.

Journalists who believe in women's equality should not spread sexual smears about a candidate, or snigger at her teenage daughter's pregnancy, or declare that a mother with a young family cannot hold down a responsible job for the pragmatic reason that they will look like gross hypocrites if they do. Before Palin, we saw hypocrisy of the right when shock jocks who had spent years denouncing feminism came over all politically correct when Bill Clinton had an affair with Monica Lewinsky.

In Britain, the most snobbish attacks on Margaret Thatcher did not come from aristocrats but from the communist historian Eric Hobsbawm, who opined that Thatcherism was the 'anarchism of the lower middle classes' and the liberal Jonathan Miller, who deplored her 'odious suburban gentility'. More recently, George Osborne, of the supposedly compassionate Conservative party, revealed himself to be a playground bully when he derided Gordon Brown for being 'faintly autistic'.

In an age when politics is choreographed, voters watch out for the moments when the public-relations facade breaks down and venom pours through the cracks. Their judgment is rarely favourable when it does. Barack Obama knows it. All last week, he was warning American liberals to stay away from the Palin family. He understands better than his supporters that it is not a politician's enemies who lose elections, but his friends.