  The morphology and kinematics of molecular clouds (MCs) are best explained as
the consequence of super--sonic turbulence. Super--sonic turbulence fragments
MCs into dense sheets, filaments and cores and large low density ``voids'', via
the action of highly radiative shocks. We refer to this process as "turbulent
fragmentation". In this work we derive the mass distribution of gravitationally
unstable cores generated by the process of turbulent fragmentation. The mass
distribution above one solar mass depends primarily on the power spectrum of
the turbulent flow and on the jump conditions for isothermal shocks in a
magnetized gas. For a power spectrum index \beta=-1.74, consistent with
Larson's velocity dispersion--size relation as well as with new numerical and
analytic results on super--sonic turbulence, we obtain a power law mass
distribution of dense cores with a slope equal to 3/(4-\beta) = 1.33,
consistent with the slope of the stellar IMF. Below one solar mass, the mass
distribution flattens and turns around at a fraction of a solar mass, as
observed for the stellar IMF in a number of stellar clusters, because only the
densest cores are gravitationally unstable. The mass distribution at low masses
is determined by the probability distribution of the gas density, which is
known to be approximately Log--Normal for an isothermal turbulent gas. The
intermittent nature of the turbulent density distribution is thus responsible
for the existence of a significant number of small collapsing cores, even of
sub--stellar mass. Since turbulent fragmentation is unavoidable in
super--sonically turbulent molecular clouds, and given the success of the
present model in predicting the observed shape of the stellar IMF, we conclude
that turbulent fragmentation is essential to the origin of the stellar IMF.
