The idea of this PhD thesis is to document the link between the counter-narcotics operations that took place in Afghanistan in the years 2008-2015 and the Afghan civil conflict, which has led to the terrible outcome of the year 2021. In the first chapter, I propose a microeconomic model to describe the effect of counternarcotics law enforcement on the supply of drugs when territorial control is contested. I assume, as is seen on the field, that if insurgents take power, then drug producers are protected against counter-narcotics operations, but that they have to pay taxes on their production. I show that under some circumstances the influence of drug producers on the outcome of conflict induces a complementarity between investment in narcotics production and insurgent support. This complementarity has two effects: 1) It mitigates the efficacy of counter-narcotics operations 2) It generates a trade-off between the war on drugs and counterinsurgency. In the second chapter, I address point 1) by estimating the elasticity of opium supply to counter-narcotics operations in Afghanistan. I find that law enforcement had little impact, with a 1% increase in opium eradication causing a reduction of roughly a third of a percent in opium supply the following year. Moreover, this effect is driven by northern regions, far from the Taliban’s strongholds which concentrate most of the country’s production. In the third chapter, I turn to point 2) and estimate the effect of counter-narcotics operations on the population’s self-declared support for military actors. I find that those provinces where law enforcement induced the eradication of 10% or more of the total opium-cultivated area exhibit greater sympathy for opposition armed groups, such as the Taliban, and less trust in the national army. This effect is driven by the Pashtun sub-population, which agricultural sector relies heavily on opium cultivation. These results empirically confirm the existence of a trade-off between counter-narcotics and counterinsurgency. Since law enforcement was originally meant to weaken the Taliban insurgency, these results should be of interest to policymakers.