Why is there so much variation in attitudes toward immigrants? Research consistently shows that people with lower socioeconomic status and education levels display more negative attitudes toward immigrants and that there is significant variation in public opinion between countries and over time. While common explanations such as contact theory and ethnic competition theory account for some of this variation, many questions remain unanswered. The present dissertation takes a 'sociocognitive approach', focusing on two fundamental human needs: the need to belong and the need to understand. I argue that this approach adds to existing accounts by providing an explanation for attitude change as well as helping us to explain a set of unanswered puzzles regarding variation in anti-immigrant sentiment. I argue that normative influence processes, framing, and uncertainty are key to understanding attitudes toward immigrants, and I present a series of semi-independent empirical studies using a variety of methodological approaches to tease out these mechanisms. First, a series of natural experiments reveals that there is no straightforward relationship between uncertainty and attitudes toward immigrants. Most notably, I find that public attitudes toward immigrants in the Netherlands were not affected by the 2004 murder of Theo van Gogh. Second, I propose that this may be due to the way in which the murder was interpreted in the media – an explanation that is in line with the framing hypothesis. Third, using support for an anti-immigration party as a proxy for attitudes toward immigrants I show how social identity- and normative influence processes can provide a plausible explanation for extreme levels of populist radical right support. Fourth, I present a survey experiment which reveals that there is no strong relationship between attitudes toward immigrants and support for redistribution in the UK. This finding goes against interest-based explanations of attitudes toward immigrants, thereby paving the way for a sociocognitive approach.