Knowledge of the ages of the stars formed over a galaxy's lifetime is fundamental to an understanding of its formation and evolution. However, stellar ages are difficult to obtain since they cannot be measured from observations, but require comparison with stellar models1. Alternatively, age distributions can be derived by applying the robust technique of colour-magnitude diagram fitting2, which until now has been used primarily to study nearby galaxies. Accurate distances to individual Milky Way stars now provided by the Gaia spacecraft mission3 have allowed us to derive ages from a thick-disk colour-magnitude diagram and from the two-sequenced colour-magnitude diagram of the kinematically hot local halo4, whose blue sequence has been linked to a major accretion event, Gaia-Enceladus5,6. Because accurate stellar ages were lacking, the time of the merger and its role in our Galaxy's early evolution remained unclear. Here we show that the stars in both halo sequences share identical age distributions, and are older than most of the thick-disk stars. The sharp halo age distribution cutoff at ten billion years ago can be identified with the time of accretion of Gaia-Enceladus to the Milky Way. Together with state-of-the-art cosmological simulations of galaxy formation7, these robust ages allow us to order the early sequence of events that shaped our Galaxy. We identify the red-sequence stars as the first stars formed within the Milky Way progenitor, and their kinematics indicate that these stars constitute the long-sought in situ halo of the Milky Way.