We define and study statistical ensembles of matter density profiles describing spherically symmetric, virialized dark matter haloes of finite extent with a given mass and total gravitational potential energy. Our ensembles include spatial degrees of freedom only, a microstate being a spherically symmetric matter density function. We provide an exact solution for the grand canonical partition functional, and show its equivalence to that of the microcanonical ensemble. We obtain analytically the mean profiles that correspond to an overwhelming majority of microstates. All such profiles have an infinitely deep potential well, with the singular isothermal sphere arising in the infinite temperature limit. Systems with virial radius larger than gravitational radius exhibit a localization of a finite fraction of the energy in the very center. The universal logarithmic inner slope of unity of the NFW haloes is predicted at any mass and energy if an upper bound is set to the maximal depth of the potential well. In this case, the statistically favored mean profiles compare well to the NFW profiles. For very massive haloes the agreement becomes exact.