Abstract We introduce a notion of generalized stochastic flows on manifolds, that extends to the viscous case the one defined by Brenier for perfect fluids. Their kinetic energy extends the classical kinetic energy to Brownian flows, defined as the L2 norm of their drift. We prove that there exists a generalized flow which realizes the infimum of the kinetic energy among all generalized flows with prescribed initial and final configuration. We also construct generalized flows with prescribed drift and kinetic energy smaller than the L2 norm of the drift. The results are actually presented for general Lq norms, thus including not only the Navier–Stokes equations but also other equations such as the porous media.