We propose a theoretical framework to study the determinants of ethnic and religious identity along two distinct motivational processes which have been proposed in the social sciences: cultural conformity and cultural distinction. Under cultural conformity, ethnic identity is reduced by neighborhood integration, which weakens group loyalties and prejudices. On the contrary, under cultural distinction, ethnic minorities are more motivated in retaining their own distinctive cultural heritage the more integrated are the neighborhoods where they reside and work. Data on ethnic preferences and attitudes provided by the Fourth National Survey of Ethnic Minorities in the UK enables us to test the relative significance of these two identity processes. We find evidence consistent with intense ethnic and religious identity mostly formed as a cultural distinction mechanism. Consistently, we document that ethnic identities are more intense in mixed than in segregated neighborhoods.