We have determined the cosmological evolution of the density of active galactic nuclei (AGN) and of their N H distribution as a function of the un-absorbed 2-10 keV luminosity up to redshift 4. We used the HELLAS2XMM sample combined with other published catalogs, yielding a total of 508 AGN. Our best fit is obtained with a luminosity-dependent density evolution (LDDE) model where low luminosity (L X ∼10 43 erg s −1 ) AGN peak at z∼0.7, while high luminosity AGN (L X >10 45 erg s −1 ) peak at z∼2.0. A pure luminosity evolution model (PLE) can instead be rejected.There is evidence that the fraction of absorbed (N H >10 22 cm −2 ) AGN decreases with the intrinsic X-ray luminosity, and increases with the redshift.Our best fit solution provides a good fit to the observed counts, the cosmic X-ray background, and to the observed fraction of absorbed AGN as a function of the flux in the 10 −15 10 44 erg s −1 ) AGN have a density of 267 deg −2 at fluxes S 2−10 >10 −15 erg cm −2 s −1 . Using these results, we estimate a density of supermassive black holes in the local Universe of ρ BH = 3.2 h 2 70 × 10 5 M ⊙ Mpc −3 , which is consistent with the recent measurements of the black hole mass function in the local galaxies.