This study deals with the impact of the 2015 European Refugee Crisis on the ethnic identity of resident migrants in Germany. To derive plausibly causal estimates, I exploit the quasi-experimental setting in Germany, by which refugees are allocated to different counties by state authorities without being able to choose their locations themselves. This study finds that higher shares of refugees in a county increased migrants’ attachment to their home countries, while not affecting their perceived belonging to Germany. Further analyses uncover strong heterogeneities with respect to country of origin and immigrant characteristics and suggest that the observed effects may be primarily driven by experiences of discrimination and the consumption of foreign media. Lastly, I find that changes in ethnic identity coincide with the political polarization of migrants. These results have various policy implications in terms of the dispersal of asylum seekers, the modes of communication with different migrant groups and the importance of antidiscrimination measures.