Decades ago, the sociologist Georg Simmel argued that nothing unites a nation, or any group of people for that matter, quite like having a common enemy. Recent research by Mark Landau (professor of psychology, University of Kansas), though not testing unity of groups, does indicate that having enemies provides some psychological benefits.
Specifically, Landau and colleagues argue that people have a basic need for coherence, or for things to make sense. Enemies provide people with this sense of coherence. If we can attribute many of the ills in our lives to our enemies, then we have a stable set of schemas and expectations. We know what to expect, even if something bad happens, and we know who to attribute it to.
Several studies support these ideas. In one study, participants who were lead to think about chaotic hazards were more likely to perceive people with different political beliefs as enemies (view them as more part of a conspiracy).
Interestingly, in another study, people who had just imagined a powerful enemy (Al-Qaeda) actually thought the world was less dangerous and chaotic.
Put differently, this research suggests that people create enemies in order to maintain a stable, coherent, clear view of the world. This is because they can attribute the negatives of the world (which are inevitable) to these enemies.
Having enemies even appears to make people feel, ironically, safer.
Now, to be clear, I am not encouraging people to have enemies. There are obvious drawbacks to having enemies too. And there are other ways to find life meaningful and coherent than to have enemies.
Do you have enemies because you have been harmed by them or vehemently disagree with them on some moral, political or religious view? Perhaps. But, you also possibly have enemies because you created them in order for your life to be more meaningful.