In countries affected by insurgencies, development programs may potentially reduce violence by improving economic outcomes and increasing popular support for the government. In this paper, we test the efficacy of this approach through a large-scale randomized controlled trial of the largest development program in Afghanistan at the height of the Taliban insurgency. We find that the program generally improved economic outcomes, increased support for the government, and reduced insurgent violence. However, in areas close to the Pakistani border, the program did not increase support for the government and actually increased insurgent violence. This heterogeneity in treatment effects appears to be due to differences between districts in the degree of infiltration by external insurgents, who are not reliant on the local population for support. The results suggest that while development programs can quell locally-based insurgencies, such programs may be counterproductive when implemented in areas where insurgents are not embedded in the local population.