I propose a modification of the spherical infall model for the evolution of density fluctuations with initially Gaussian probability distribution and scale-free power spectra in the Einstein—de Sitter universe as developed by Hoffman & Shaham. I introduce a generalized form of the initial density distribution around an overdense region and cut it off at half the interpeak separation, accounting in this way for the presence of the neighbouring fluctuations. Contrary to the original predictions of Hoffman & Shaham, the resulting density profiles within virial radii no longer have a power-law shape, but their steepness increases with distance. The profiles of haloes of galactic mass are well fitted by the universal profile formula of changing slope obtained as a result of N-body simulations by Navarro, Frenk & White. The trend of steeper profiles for smaller masses and higher spectral indices is also reproduced. The agreement between the model and simulations is better for smaller masses and lower spectral indices, which suggests that galaxies form mainly by accretion, while formation of clusters involves merging.