In 1500, Europe was composed of hundreds of statelets and principalities, with weak central authority, no monopoly over the legitimate use of violence, and overlapping jurisdictions. By 1800, only a handful of powerful, centralized nation states remained. We build a model that explains both the emergence of capable states and growing divergence between European powers. We argue that the impact of war was crucial for state building, and depended on: i) the financial cost of war, and ii) a country’s initial level of domestic political fragmentation. We emphasize the role of the "Military Revolution", which raised the cost of war. Initially, this caused more cohesive states to invest in state capacity, while more divided states rationally dropped out of the competition, causing divergence between European states. As the cost of war escalated further, all states engaged in a "race to the top" towards greater state building.