In the wake of deadly attacks in Paris last week, many Americans and plenty of Republican governors have been quick to voice concern over all Syrian refugees. Letting people in to the United States from a war-torn country, they argue, will make it easier for terrorists to get here, too.

It’s not the first time that terrifying events have fueled fear and condemnation of entire groups of people. A haunting parallel occurred during World War II, when the United States forced 120,000 Japanese-Americans into detention camps after the bombing of Pearl Harbor.

As policy debates intensify in Congress, it’s worth examining the psychological factors that propel prejudice and xenophobia, experts say. By recognizing those underlying tendencies, we might be able to find a more peaceful path forward.

Refugee Boy on Beach: Photos That Shook the World

“A xenophobic response is especially likely to emerge under conditions in which people feel more vulnerable,” said Mark Schaller, a psychologist the University of British Columbia in Vancouver. That suggests, he adds, that “these prejudices are likely to be reduced under circumstances in which people feel less vulnerable. The implication is that public policy interventions can help.”

Even though the United States is a nation built on immigration, more recent immigrants have often been met with deep suspicion. And foreigners frequently get blamed for overpopulation, violence, pollution, economic woes, terrorism and more. Infographic: The Screening Process for Refugee Entry into the United States

To understand where those attitudes come from, social scientists have proposed a variety of theories, many of them rooted in evolutionary principles that focus on prehistoric times, when humans lived in small groups. While cooperation within groups would have been important, Schaller says, clashes between groups likely led to violence, at least some of the time. Creating a hard line between “them” and “us,” then, would have been a matter of survival.

Today, fear of danger is a deeply human experience that tends to intensify under threatening conditions. The same is true for prejudice, which can be exacerbated by all sorts of perceived threats, including fear of infection by disease and fear of economic turmoil during recessions.

Perhaps most relevant to recent events, fear of foreigners also often surges when people feel threatened physical in the context of war, terrorism, or even darkness. In a small 2003 study, simply being in a dark room made non-black participants more likely to express suspicious attitudes about black men.

Did Climate Change Tip Syria into War?

“When people feel more vulnerable to physical harm,” Schaller said, “they are likely to be more prejudiced against people who seem to be ‘one of them’ rather than ‘one of us.’”

But evolution alone cannot explain the fear and hatred that so many people express about modern-day immigrants, says Oskana Yakushko, a psychologist at the Pacifica Graduate Institute in Carpinteria, Calif.

Instead, she argues that xenophobia – along with racism, sexism, homophobia and other kinds of prejudice – emerge within social and historical contexts that intersect with the psychological tendency to create social hierarchies.

Why Syria Is Russia's Closest Ally in the Middle East

“In Europe and the United States, we tend to feel like we’re at the top of the pecking order and that’s how it’s supposed to be,” Yakushko said. “There’s no sense that we’re all in this together.”

But immigration does not always spark panic, she says. And even in times of crisis, not everyone reacts with prejudice. That suggests that xenophobia may come from outside of us, instead of being embedded within us.

“I think if it were innate, we would all just go bonkers about how the immigrants are coming, and we don’t,” she said. “A host of other people feel such a commitment to welcoming them, to say, ‘My gosh, these people are traumatized and fighting for their lives and trying to save their children, and I want to help.’”

Paris Attacks: Inside the Minds of Terrorists

Research also suggests a way out. For a 2013 study, Yakushko and colleagues surveyed Norwegian students about their attitudes toward immigrants. They found that living near or being exposed frequently to foreigners didn’t make respondents more accepting of foreigners. But when they had direct and meaningful contact with members of other groups, they were far more likely to care about their stories and far less likely to be afraid.

“You might live in a community with immigrants, but that doesn’t mean you have a warm and fuzzy feeling about people coming in,” she said. “If you have a relationship with someone, that’s what changes your attitude.”