We examine how agricultural subsidies may induce deforestation and interact with conservation programs by analyzing two large-scale national programs in Mexico that have existed simultaneously for more than a decade: an agricultural subsidy for livestock (PROGAN) and a program of payments for ecosystem services (PES). Looking across the entire Mexican landscape, we exploit the surprises in the timing of enrollment in PROGAN's waves, fluctuations in program payments, and the change in the value of the subsidy induced by inflation and currency fluctuations to identify the impacts of the livestock subsidy on environmental outcomes. We find that PROGAN increased municipal deforestation by 7 per cent. The deforestation effects of PROGAN were smaller in municipalities with higher concentrations of PES recipients. We suggest that livestock subsidies could be better targeted to places with low deforestation risk and high livestock productivity to maximize food production and minimize negative externalities caused by deforestation.