Mg, Mg/P, and Mg/Ar implantations were performed into InP:Fe with an energy of 80 keV for obtaining shallow p(+) layers suitable for device applications. After rapid thermal annealing at 850 or 875 degrees C for 5 or 10 s, activations between 10 and 50% and mobilities as high as 110 cm(2)/Vs were obtained for the different doses employed. For the implantations with 10(14) cm(-2), differential Hall measurements showed hole profiles with peak concentrations in the mid-10(18) cm(-3) range and Hall mobilities of 90 cm(2)/Vs. However, secondary ion mass spectrometry profiles showed a clear pileup of Mg at the surface and in-diffusion tails deeper than 2 mu m. Phosphorus or Ar co-implantation reduced the Mg in-diffusion and increased the activation, but not as clearly as in the case of Be implants. Photoluminescence (PL) measurements demonstrated the good crystalline quality of the material after all the annealing cycles employed. In the photoluminescence spectra, together with narrow emissions close to the gap wavelength, two broad bands, centered at about 1.3 and 0.87 eV were found, this last being the dominant emission of the PL spectra from the layers with higher implanted doses. The origin of this band is tentatively assigned to complexes involving Mg and a defect.