How do external threats affect leaders' incentives to repress? We argue that external threats both increase and decrease state repression, but through different causal pathways. Directly, external threats provide leaders with political cover to use repression against political opponents. Indirectly, threats incentivize leaders to augment state capacity, which decreases the likelihood of state repression. To test this argument, we develop a new latent measure of external threat using a Bayesian measurement model. We use mediation analysis to examine the direct and indirect effects of external threats on repression in developing countries from 1980 to 2016. We find that external threats increase government repression directly, but indirectly decrease repression through stronger state capacity. Our findings have implications for how international factors connect to domestic politics to help explain state repression. In addition, our new measure of external threat will help scholars study the consequences of the international threat environment.