Abstract: A method for compensating operationally-induced defects in a semiconductor device which includes a semiconductor body having opposed major surfaces and having first and second region therein. The method comprises determining the thickness of the second region by the energy level of the defects relative to the equilibrium Fermi level and introducing a compensating material into the second region. In the semiconductor device the thickness of the second region extends from a major surface to a position in the body at which the energy level of the defects is about equal to the equilibrium Fermi level. The semiconductor device is typically a photodetector comprising a first layer having a first conductivity type, the first region overlies the first layer and has an intrinsic conductivity type, the second region overlies the first region and has a conductivity type opposite to that of the first layer, and a second layer overlies the second region and has the same conductivity type of the second region.