In the present letter, Mg-doped GaN thin films grown by metalorganic vapor-phase epitaxy were studied using parallel electron energy-loss spectroscopy in a transmission electron microscope. A microstructural characterization of such thin films showed the presence of pyramidal defects (PDs) with a density of about 10(18) cm(-3). Comparison of energy-loss spectra recorded outside a PD and from the PD showed a significant change in the energy-loss near-edge structure strongly reflecting the presence of inclusions (Mg-based), the electronic properties of which differ from those of GaN. Considering, however, their relatively high density (similar to 10(18) cm(-3)), one can expect that the optical properties of such inclusions may interfere with those of GaN and, therefore, be at the origin of the frequently obtained blue emission at 2.8-2.9 eV in heavily doped samples. (C) 2000 American Institute of Physics. [S0003-6951(00)00740-3].