I show that the so-called causality paradox of time-dependent density functional theory arises from an incorrect formulation of the variational principle for the time evolution of the density. The correct formulation not only resolves the paradox in real time, but also leads to a new expression for the causal exchange-correlation kernel in terms of Berry curvature. Furthermore, I show that all the results that were previously derived from symmetries of the action functional remain valid in the present formulation. Finally, I develop a model functional theory which explicitly demonstrates the workings of the new formulation.