I develop a theory of political organization grounded in the algorithmic logic of Darwinian selection. Modern political systems sustain large-scale cooperation and reduce parasitism through the generation of institutions that select for favorable policy strategies and their associated behavioral traits. Competition over what traits should be favored requires institutions that explore variation in traits or strategies, while exploiting the value of existing traits that yield cooperative benefits. These insights are translated into three principles of political organization, principles that place constitutional democracy atop a series of major transitions in the evolution of cooperation.