We study how natural resources can feed corruption and how this effect depends on the quality of the democratic institutions. Our game-theoretic model predicts that resource rents lead to an increase in corruption if the quality of the democratic institutions is relatively poor, but not otherwise. We use panel data covering the period 1980-2004 and 124 countries to test this theoretical prediction. Our estimates confirm that the relationship between resource rents and corruption depends on the quality of the democratic institutions. Our main results hold when we control for the effects of income, time varying common shocks, regional fixed effects and various additional covariates. They are also robust across different samples, and to the use of various alternative measures of natural resources, democracy and corruption.