A transmission electron microscopy study of a wide range of p-type GaN samples reveals that high Mg doping has a strong influence on the polarity of GaN. The main characteristic of Mg-doped metal organic vapour phase epitaxy (MOVPE) and bulk GaN is the presence of pyramidal inversion domains (PIDs). It is shown that the appearance of PIDs is correlated with a decrease of the free hole concentration and with the appearance of the blue photoluminescence band which is characteristic of MOVPE-grown Mg-doped GaN. A tentative model based on electrostatic considerations is proposed for this blue luminescence band. (C) 2002 Elsevier Science B.V. All rights reserved.