This only worked because the ruling class was as violent and murderous as the criminals.
In modern days a murderer could not care less that two people of his nationality would die as result of his actions. Actually, he could just feel even more powerful, scary, and influent.
According to Saxo Grammaticus, in medieval Danish law when a foreigner slew a Dane, two foreigners must be put to death.
Disproportionate penalty was seen as justice because foreigners lacked the same kinship and legal protections (weregild) that Danes enjoyed, so the society mandated a harsher, collective penalty for them. They believed rulers owed their people an uncompromising deterrent to prevent outsiders from disturbing the peace or assaulting native Danes.
Something to think about.