What explains local variation in electoral manipulation in countries with ongoing internal conflict? The theory of election fraud developed in this article relies on the candidates’ loyalty networks as the agents manipulating the electoral process. It predicts (i) that the relationship between violence and fraud follows an inverted U-shape and (ii) that loyalty networks of both incumbent and challenger react differently to the security situation on the ground. Disaggregated violence and election results data from the 2009 Afghanistan presidential election provide empirical results consistent with this theory. Fraud is measured both by a forensic measure, and by using results from a visual inspection of a random sample of the ballot boxes. The results align with the two predicted relationships, and are robust to other violence and fraud measures.