  X-ray absorption fine-structure (XAFS) measurements supported by {\em ab
initio} computations within the density functional theory (DFT) are employed to
systematically characterize Fe-doped as well as Fe and Si-co-doped films grown
by metalorganic vapour phase epitaxy. The analysis of extended-XAFS data shows
that depending on the growth conditions, Fe atoms either occupy Ga
substitutional sites in GaN or precipitate in the form of $\epsilon$-Fe$_3$N
nanocrystals, which are ferromagnetic and metallic according to the DFT
results. Precipitation can be hampered by reducing the Fe content, or by
increasing the growth rate or by co-doping with Si. The near-edge region of the
XAFS spectra provides information on the Fe charge state and shows its partial
reduction from Fe$^{+3}$ to Fe$^{+2}$ upon Si co-doping, in agreement with the
Fe electronic configurations expected within various implementations of DFT.
