This paper assesses the role of ideas in economic change, combining economic and historical analysis with insights from psychology, sociology and anthropology. Belief systems shape the system of categories ("pre-confirmatory bias") and perceptions (confirmatory bias), and are themselves constrained by fundamental values. We illustrate the model using the historical construction of racial categories. Given the post-Reformation fundamental belief that all men had rights, colonial powers after the 15th century constructed ideologies that the colonized groups they exploited were naturally inferior, and gave these beliefs precedence over other aspects of belief systems. Historical work finds that doctrines of race came into their own in the colonies that became the US after, not before, slavery; that out of the "scandal of empire" in India emerged a "race theory that cast Britons and Indians in a relationship of absolute difference"; and that arguments used by the settlers in Australia to justify their policies towards the Aborigines entailed in effect the expulsion of the Aborigines from the human race. Racial ideology shaped categories and perceptions in ways that we show can give rise to equilibrium fictions. In our framework, technology, contacts with the outside world, and changes in power and wealth matter not just directly but because they can lead to changes in ideology.