We report on the magnetic properties of GaN:Gd layers grown by molecular beam epitaxy. A poor reproducibility with respect to the magnetic properties is found in these samples. Our results show strong indications that defects with a concentration of the order of 10 cm might play an important role for the magnetic properties. Positron annihilation spectroscopy does not support a direct connection between the ferromagnetism and the Ga vacancy in GaN:Gd. Oxygen codoping of GaN:Gd promotes ferromagnetism at room temperature and points to a role of oxygen for mediating ferromagnetic interactions in Gd-doped GaN.











