Aims. To study the cosmological evolution of active galactic nuclei (AGN) is one of the main goals of X-ray surveys. To accurately determine the intrinsic (before absorption) X-ray luminosity function, it is essential to constrain the evolutionary properties of AGN and therefore the history of the formation of supermassive black holes with cosmic time. Methods. In this paper we investigate the X-ray luminosity function of absorbed (log N H > 22) and unabsorbed AGN in three energy bands (soft: 0.5−2 keV, hard: 2−10 keV and ultrahard: 4.5−7.5 keV). For the hard and ultrahard sources we have also studied the N H function and the dependence of the fraction of absorbed AGN on luminosity and redshift. This investigation is carried out using the XMS survey along with other highly complete flux-limited deeper and shallower surveys in all three bands for a total of 1009, 435, and 119 sources in the soft, hard and ultrahard bands, respectively. We modelled the instrinsic absorption of the hard and ultrahard sources (N H function) and computed the X-ray luminosity function in all bands using two methods. The first makes use of a modified version of the classic 1/V a technique, while the second performs a maximum likelihood (ML) fit using an analytic model and all available sources without binning. Results. We find that the X-ray luminosity function (XLF) is best described by a luminosity-dependent density evolution (LDDE) model. Our results show good overall agreement with previous results in the hard band, although with slightly weaker evolution. Our model in the soft band present slight discrepancies with other works in this band, the shape of our present day XLF being significantly flatter. We find faster evolution in the AGN detected in the ultrahard band than those in the hard band. Conclusions. The results reported here show that the fraction of absorbed AGN in the hard and ultrahard bands is dependent on the X-ray luminosity. We find evidence that this fraction evolves with redshift in the hard band, whereas there is none in the ultrahard band, possibly due to the low statistics. Our best-fit XLF shows that the high-luminosity AGN, detected in all bands, exhibit a similar behaviours and are fully formed earlier than the less luminous AGN. The latter sources account for the vast majority of the accretion rate and mass density of the Universe, according to an anti-hierarchical black hole growth scenario.