War zones are usually portrayed as chaotic and anarchic. In irregular civil wars, however, they are often ordered. Furthermore, different forms of order often coexist in areas controlled by the same non-state armed group, where the behavior of both civilians and combatants vary substantially. What explains this variation? In this paper I present a theory of the creation of order in war zones that analyzes the behavior of non-state armed groups, the responses of local populations, and the effect of their interaction on wartime institutions. My central argument is that disorder emerges when armed groups have short time horizons, which usually happens when they fight for control with other warring sides or are undisciplined; under these conditions, they are unlikely to establish a social contract with the local population. When armed groups have a long time horizon, a social contract is established, giving place to a new order. In this new order, armed groups may intervene minimally or broadly in civilian affairs; their choice, I argue, depends on the likelihood of organized civilian resistance, which is, in turn, a function of the quality of pre-existing local institutions, especially those dealing with adjudication of disputes. I also present extensions of the theory that account for variation in the strategic value of territory, variation in local capacity for collective action, and armed groups’ information about local institutions.