Civil conflicts spill over into neighboring countries. This paper proposes a theory of the contagion of civil wars. Weak territorial control facilitates the emergence of a regional market for war inputs in the “porous frontier.” The contagion effect is nonlinear and creates multiple equilibrium situations of regional complexes of civil conflicts. This helps explain the observed patterns of regional clustering of conflict and institutional quality, and raises identification issues in the measurement of the contagion effect. We also derive a positive spillover of civil wars: governments are sometimes in a position to avoid contagion by improving their institutions. Finally, we explore the policy implications for military intervention, and military and institutional cooperation.