  N-body simulations and analytical calculations of the gravitational collapse
in an expanding universe predict that halos should form with a diverging inner
density profile, the cusp. There are some observational indications that the
dark matter distribution in galaxies might be characterized by a finite core.
This `core catastrophe' has prompted a search for alternatives to the CDM
cosmogony. It is shown here that the discrepancy between theory and
observations can be very naturally resolved within the standard CDM model,
provided that gas is not initially smoothly distributed in the dark matter
halo, but rather is concentrated in clumps of mass $\geq 0.01 %$ the total mass
of the system. Dynamical friction acting on these lumps moving in the
background of the dark matter particles, dissipates the clumps orbital energy
and deposits it in the dark matter. Using Monte-Carlo simulations, it is shown
that the dynamical friction provides a strong enough drag, and that with
realistic baryonic mass fractions, the available orbital energy of the clumps
is sufficient to heat the halo and turn the primordial cusp into a finite,
non-diverging core --- overcoming the competing effect of adiabatic contraction
due to gravitational influence of the shrinking baryonic component. Depending
on the initial conditions, the total density distribution may either become
more or less centrally concentrated. Possible consequences of the proposed
mechanism for other problems in the CDM model and for the formation and early
evolution of the baryonic component of galaxies are also briefly discussed.
