Why do modern states regulate and provide mass education? This article proposes a theory of education as a state-building tool that is deployed when mass violence threatens the state’s viability. Experiencing mass violence can heighten national elites’ anxiety about the masses’ moral character and raise concerns about the efficacy of repression or concessions alone to maintain social order. In this context, a mass education system designed to teach obedience can become an attractive policy tool to prevent future rebellion and promote long-term order. Consistent with the theory, I detect a cross-national pattern of primary education expansion following civil wars in Europe and Latin America. In a complementary study of the 1859 Chilean civil war, I show that the central government responded by expanding primary schooling in rebel provinces not as a concession but to teach obedience and respect for authority. The theory helps explain why nondemocracies often expanded mass education.