Introducing an international relations perspective into the literature on anti-immigrant attitudes, we hypothesize that immigrants from rival countries will be shunned and immigrants from allied countries preferred, especially by respondents who identify more strongly with the nation. We fielded a forced-choice conjoint experiment in 22 countries, whereby respondents chose between applicants for permanent resident status with randomized attributes. We identified rival and allied countries of origin for each surveyed country, with one such pair sharing a similar racial and cultural make-up as the majority of respondents, and one pair being more dissimilar. We find that discrimination against immigrants from rival states is so pronounced that it results in a net preference for racially and culturally dissimilar immigrants. Since we fielded the surveys amidst the Russian invasion of Ukraine, we are able to leverage exogenous changes in the intensity of one rivalry, providing further evidence for the proposed mechanism.