Why do developing countries fail to adopt the institutions and policies that promote development? Our answer is the violence trap. Natural states prevent violence by providing rents to those with high violence potential. To create rents, however, they must limit entry, which hinders the development of a complex economy whose workings will be seriously disrupted by domestic conflict (raising the cost of fighting) and whose profits will be hard to confiscate (lowering the benefit). Thus, natural states' policy of rent creation hinders the development of the sort of complex economies that would lower the expected payoff to fighting for control of the state. Empirically, we show that economic complexity (as measured by the Hidalgo- Hausmann index) strongly deters coups, even controlling for GDP per capita and level of democracy. Our results remain similar when we instrument economic complexity using the mean complexity of each country's neighbours.