Last month's deadly attacks in Norway appear to have been an extreme outcome of a broader backlash against immigrants in parts of Europe.
This growing unease about immigrants raises a deeper question about such attitudes: Is it human nature to distrust those who come from outside our own community?
What Our Primate Ancestry Tells Us
"I think there's probably a very deep-rooted fear and suspicion of outsiders," says Michael Wilson, a primatologist at the University of Minnesota.
Wilson's conclusion about people is based on his studies of chimpanzees, among our closest evolutionary relatives.
If you look at chimps, he says, they are extremely territorial.
When two groups of chimps bump into each other in the forest, it always leads to conflict. Males threaten each other with loud calls and aggressive gestures. And, occasionally, things escalate to physical violence and warfare.
"If they can grab a member of the other community, they may beat on them, bite them, and continue doing so until they're very severely injured or killed," says Wilson.
(See this video for an example of inter-group conflict among chimps. It was recorded by Wilson's colleague in Tanzania, in 1998.)
He says it makes sense chimps defend their territories. Several studies have shown that a bigger territory means more food for the group, and a better chance of survival.
But if chimps say anything about our own evolutionary past, so do bonobos. They're a smaller species of apes, also closely related to us.
Primatologist Frans de Waal of Emory University has studied what happens when two groups of bonobos encounter each other.
"They have initial hostility, but then they have sex, and they groom, and very soon it looks more like a picnic than like warfare between them," says de Waal.
No one really knows why bonobos are friendlier than chimps. It could be because bonobos live in forests with more food and therefore don't need to protect their resources from neighbors, de Waal speculates.
So what do we make of our primate ancestry, when two of our closest evolutionary cousins are so different?
According to de Waal, what is common to these two species and all other primates is an acute awareness of who is an insider and who is an outsider.
"Sort of bred into the primate line is that you belong to a group and you don't necessarily like outsiders," he says.
And it is this ancient psychology that is at play when we go to war against neighboring nations, or when we clash with people from a culture or ethnicity different from our own, he added.
Conflict and Cooperation: A Mixed History
Yet human psychology is far more complex and flexible than our primate lineage suggests.
"We have this history of sort of a complex relationship with the neighbors that is sometimes hostile, sometimes friendly, sometimes cooperative," says de Waal. "So we have this flexibility that I don't see much of in other primates."
He says human beings have a history of cooperating with outsiders when it's mutually beneficial.
This history of being friendly and cooperating with outsiders is reflected in contemporary hunter-gatherer societies.
For example, the !Kung people in Southern Africa walk for miles giving small gifts to neighboring communities.
They do this as insurance against harsh times says Samuel Bowles, the director of behavioral sciences at the Santa Fe Institute.
"Why do they travel such long distances? Because they'd like to be welcome in these places if things go wrong back home."
But human behavior isn't determined by biology alone. Culture plays a big role.
And we can choose to change a culture of conflict to a culture of cooperation, says Bowles.
We have already done that to a great extent in recent history, he adds. Take, for example, the creation of modern European countries.
"The nations of Europe were composed as recently as 500 years ago of literally hundreds of little governments, city states, some run by church groups, including some areas run by pirates," he says. "They were just little statelets all over the place."
Now those tiny statelets have coalesced into nations, and some of those nations have merged into a larger European Union.
Bowles says that our definition of who is an insider and who is an outsider has changed over time. And despite anti-immigrant sentiment in parts of Europe, he is hopeful that societies there and elsewhere will become more inclusive with time.