  The widely known relation between stellar mass and gas metallicity
(mass-metallicity relation, MZR) in galaxies is often ascribed to the higher
capability of more massive systems to retain metals against the action of
galactic outflows. In this scenario the stellar mass would simply be an
indirect proxy of the dynamical mass or of the gravitational potential. We test
this scenario by using a sample of more than one thousand star-forming galaxies
from the MaNGA survey for which dynamical masses have been accurately
determined. By using three different methods (average dispersion, Partial
Correlation Coefficients, Random Forest) we unambiguously find that the gas
metallicity depends primarily and fundamentally on the stellar mass. Once the
dependence on stellar mass is taken into account, there is little or no
dependence on either dynamical mass or gravitational potential (and, if
anything, the metallicity dependence on the latter quantities is inverted). Our
result indicates that the MZR is not caused by the retention of metals in more
massive galaxies. The direct, fundamental dependence of metallicity on stellar
mass suggests the much simpler scenario in which the MZR is just a consequence
of the stellar mass being proportional to the integral of metals production in
the galaxy.
