We provide a new framework to account for the diverging paths of political development and state building in China and Japan during the second half of the nineteenth century. The arrival of Western powers not only brought opportunities to adopt new technologies, but also fundamentally threatened the national sovereignty of both Qing China and Tokugawa Japan. We argue that these threats produce an unambiguous tendency toward centralization and modernization for small states, but place conflicting demands on geographically larger states. We use our theory to study why China, which had been centralized for much of its history, experienced gradual disintegration upon the Western arrival, and how Japan, which had been politically fragmented for centuries, rapidly unified and modernized during the same period. To further demonstrate its validity, we also apply our model to other historical episodes of state building, such as the unification of Anglo-Saxon England in the tenth century and the rise of Muscovy during the fifteenth century.