State capacity matters for economic growth. I test Bates' explanation of states in pre-colonial Africa. He argues that trade across ecological boundaries promoted states. I find that African societies in ecologically diverse environments had more centralized pre-colonial states. This result is robust to reverse causation, omitted heterogeneity, and alternative interpretations of the link between diversity and states. I test mechanisms by which trade promoted states, and find that trade supported class stratification between rulers and ruled. My results underscore the importance of ethnic institutions and inform our knowledge of the effects of geography and trade on institutions