In this contribution we demonstrate both experimentally and theoretically the possibility to control the profile of internal electric field by compensation of the space charge formed by carriers trapped at deep levels QT with space charge present due to band bending at the metal/CdTe interface QM.The demonstrated mechanism represents a promising way to decrease the problems associated with charge collection efficiency in CdTe x-ray detectors operated at high fluxes of x-ray photons.