We study discrimination against immigrants using microlevel data from Switzerland, where, until recently, some municipalities used referendums to decide on the citizenship applications of foreign residents. We show that naturalization decisions vary dramatically with immigrants’ attributes, which we collect from official applicant descriptions that voters received before each referendum. Country of origin determines naturalization success more than any other applicant characteristic, including language skills, integration status, and economic credentials. The average proportion of “no” votes is about 40% higher for applicants from (the former) Yugoslavia and Turkey compared to observably similar applicants from richer northern and western European countries. Statistical and taste-based discrimination contribute to varying naturalization success; the rewards for economic credentials are higher for applicants from disadvantaged origins, and origin-based discrimination is much stronger in more xenophobic municipalities. Moreover, discrimination against specific immigrant groups responds dynamically to changes in the groups’ relative size.