A great deal of experimental evidence suggests that a wide spectrum of phase transitions occur in a multistage manner via the appearance and subsequen transformation of intermediate metastable states. Such multistage mechanisms cannot be explained within the realm of the classical nucleation framework. Hence, there is a strong need to develop new theoretical tools to explain the occurrence and nature of these ubiquitous intermediate phases. Here we outline a unified and self-consistent theoretical framework to describe both classical and nonclassical nucleation. Our framework provides a detailed explanation of the whole multistage nucleation pathway showing in particular that the pathway involves a single energy barrier and it passes through a dense phase, starting from a low-density initial phase, before reaching the final stable state. Moreover, we demonstrate that the kinetics of matter inside subcritical clusters favours the formation of nucleation clusters with an intermediate density, i.e. nucleation precursors. Remarkably, these nucleation precursors are not associated with a local minimum of the thermodynamic potential, as commonly assumed in previous phenomenological approaches. On the contrary, we find that they emerge due to the competition between thermodynamics and kinetics.