A gauge-invariant wave equation for the dynamics of hybrid quantum–classical systems is formulated by combining the variational setting of Lagrangian paths in continuum theories with Koopman wavefunctions in classical mechanics. We identify gauge transformations with unobservable phase factors in the classical phase-space and we introduce gauge invariance in the variational principle underlying a hybrid wave equation previously proposed by the authors. While the original construction ensures a positive-definite quantum density matrix, the present model also guarantees the same property for the classical Liouville density. After a suitable wavefunction factorization, gauge invariance is achieved by resorting to the classical Lagrangian paths made available by the Madelung transform of Koopman wavefunctions. Due to the appearance of a phase-space analogue of the Berry connection, the new hybrid wave equation is highly nonlinear and it is proposed here as a platform for further developments in quantum–classical dynamics. Indeed, the associated model is Hamiltonian and appears to be the first to ensure a series of consistency properties beyond positivity of quantum and classical densities. For example, the model possesses a quantum–classical Poincaré integral invariant and its special cases include both the mean-field model and the Ehrenfest model from chemical physics.