It's all a question of boundaries who stands inside or outside our territorial and psychological boundaries.
Periodically, the masses lay down the rules even in dictatorships. Fired up by deep feelings, they reset the socio-political boundaries.
There's immigration, and attitudes toward victims and refugees. There's rivalry between different interest-groups within a nation. Then there are authority-figures and the privileged and powerful: their power can nowadays turn quickly against them.
These vexing questions concern a group's self-definition what it sees itself to be and exist for. It's feelings-based, sometimes highly instinctive. Public sentiment plays a big role in shaping the 21st C, even if only at intense defining moments.
We all need to belong, to be counted in. In doing so, we usually omit to consider those excluded and counted out, or we dehumanise them, to deny their needs or rights.
The need to belong and the need to exclude are genuine. But resources are often limited, and accommodating outsiders involves input, effort, time and cost. These questions often lack objectivity. "If we take them in, there will be less for us, and our identity could be weakened we might stop being us." The historic tendency is to close ranks against threat.
But hang on, aren't virtually all nations made up of immigrants, and don't we all live in the same world, affecting one another? If you were a refugee, how would you feel?
When a nation is genuinely threatened, there is short-term justification in closing ranks though it hurts dissenters, foreigners and marginal cases deemed a security risk. When it becomes longterm, and there is no real threat, the matter is different. Some nations make a habit of this. Arguably, the Cold War and the War on Terror have both been a projection us-and-them, belonging stuff.