however in the central region the depth of a moderately graded p n junction obtained by implanting be ions is smaller than that of a steeply graded p n junction obtained by implanting cd or zn so that the element characteristics are little affected a feature of this embodiment is as follows that is the overlap margin of the guard ring formed by diffusion of be ions and the light detecting region formed by diffusion of cd or zn is increased to allow a decrease in size of the pattern so that the entire p n junction area is reduced thus decreasing a parasitic capacitance fig8 is a sectional view showing a schematic structure of an apd according to a third embodiment of the present invention in fig8 reference numeral 51 denotes an n inp substrate on the substrate 51 an n inp buffer layer 52 an n gainasp light detecting layer 53 having a composition lattice matched with inp an n gainasp first intermediate layer 54a absorption wavelength 1 3 u03bcm an n gainasp second intermediate layer 54b absorption wavelength 1 1 u03bcm an n inp avalanche multiplication electric field relaxation layer 55 an n inp window layer 56 are grown and formed and an annular semiconductor spacing layer 57 in formed thereon the spacing layer 57 consists of e g inp the spacing layer 57 may be a crystal of gainasp gainas or the like when the composition and thickness of the spacing.