Do you own a pet dog? Do you eat meat? No, this isn't yet another lecture about how you're damaging the planet. It's a question about morality, and the question is this. If you had a dog, and it died a natural death, how would you feel about roasting and eating it?

Utterly revolted? You're not alone. Yet why the objection? Your dog's dead; you're doing it no harm. It's deceased, not diseased, so eating it won't harm you. In other cultures people eat dog meat. It's nourishing protein: fine with a decent sauce, I'm told.

To most westerners these arguments make no difference. Eating your dog is an abomination, end of story. It's an instant judgment, unimpressed by the lack of harm, impervious to reason. Both secular and religious teachings struggle to make sense of such oddities of moral decision-making. Meanwhile, different cultures are perennially revolted by each others' customs.

The profound moral instincts which stop us eating dead pets are fuelled by the emotion of disgust. We don't like to dwell on that feeling – it's disgusting! – but it's hugely important to our moral lives. Physically, disgust keeps us healthy by steering us away from sources of infection. It warns of dangers we can't see: pathogens and poisons. The same signal's just as effective when it comes to invisible social and moral dangers.

Disgust is contagious. We catch it easily from others, and it tells us what's acceptable and what isn't. Eating chicken: yes. Eating your pet dog: no, abomination. That's the rule our culture happens to follow. Eating Fido violates the rule and risks your being made a social pariah for having broken the moral code. It makes you untrustworthy, likely to break other, more important rules. Disgust, by contrast, keeps you clean and pure, up on the moral high ground. It thereby protects you from being punished by your community – or worse, being seen as disgusting yourself.

That's the dark side of disgust: its ability to dehumanise. Disgust destroys empathy and mutuality, pushing people apart, making any disgusting person very vulnerable. Psychologist Jonathan Haidt used hypnosis to make people feel disgust without realising why; their moral judgments became much more severe. That has major implications. It's why politicians who benefit from anti-immigration feeling dwell so much on migrants who do dirty, unpleasant jobs, not on immigrant doctors or academics. Instincts kick in, and revulsion builds up an impregnable layer of prejudice. (Or, as we call it when enough of us acquire it, moral principle.)

There's more. Disgust, you recall, signals invisible threats, like viruses. That's very useful in certain unpleasant kinds of politics, because disgust can make a problem, or an enemy, seem dangerous even when there's little real danger. That's why you'll find the language of disgust littering the path to every mass killing and genocide in history. It calls its victims plagues and cancers, rats, cockroaches, filth – with what terrible results we all know. Revulsion can bring out the worst in human nature.

Disgust can make people good or bad, moral or murderous. Like other emotions, it can appear incomprehensible or go unrecognised, leaving us at a loss to explain ourselves. Yet this vulgar reminder of fleshy weakness and corruption is central to what makes us human beings. We're social creatures, and morality is inescapably social. Moral systems, religious and secular, struggle with disgust's dangerous double-sidedness, but struggle we must: globalisation and burgeoning populations demand we somehow learn to live with this most social of emotions. Moral judgments draw, of course, on empathy, generosity, loving-kindness. But they also grow out of disgust.