  Context. Molecular clouds are known to be turbulent and strongly affected by
stellar feedback. Moreover, stellar feedback is believed to drive turbulence at
large scales in galaxies.
  Aims. We study the role played by supernovae in molecular clouds and the
influence of the magnetic field on this process.
  Methods. We performed three-dimensional numerical simulations of supernova
explosions, in and near turbulent self-gravitating molecular clouds. In order
to study the influence of the magnetic field, we performed both hydrodynamical
and magnetohydrodynamical simulations. We also ran a series of simple uniform
density medium simulations and developed a simple analytical model.
  Results. We find that the total amount of momentum that is delivered during
supernova explosions typically varies by a factor of about 2, even when the gas
density changes by 3 orders of magnitude. However, the amount of momentum
delivered to the dense gas varies by almost a factor of 10 if the supernova
explodes within or outside the molecular cloud. The magnetic field has little
influence on the total amount of momentum injected by the supernova explosions
but increases the momentum injected into the dense gas.
  Conclusions. Supernovae that explode inside molecular clouds remove a
significant fraction of the cloud mass. Supernovae that explode outside have a
limited influence on the cloud. It is thus essential to know sufficiently well
the correlation between supernovae and the surrounding dense material in order
to know whether supernovae can regulate star formation effectively.
