One of the most striking institutional features of many less developed countries is that their militaries are closely involved in policy-making, potentially having a large impact on economic outcomes. This paper examines the role of the military in setting policy. For this purpose it develops one of the first models of the military, where its political involvement can take two forms: direct when the military runs the government, and indirect when it influences policy without governing directly. We focus on civilian regimes and find that war decreases the payoff to the military from both forms of involvement, but also makes staging successful coups easier. In equilibrium, an increase in the likelihood of war makes indirect involvement less likely; its impact on coups, which are aimed at establishing direct control, is non-monotonic. We show empirical evidence for this non-monotonic relationship, with coups being least likely for low and high probabilities of war.