Iron is a common trace impurity in the group-III nitrides. Iron is also intentionally introduced in III-nitride electronic devices to create semi-insulating substrates and in the context of spintronics and quantum information applications. Despite the wide-ranging consequences of iron's presence in III-nitrides, the properties of iron impurities in the nitrides are not fully established. We investigate the impact of iron impurities on the electrical and optical properties of GaN, AlN, and InN using first-principles calculations based on a hybrid functional. We report formation energies of substitutional and interstitial iron impurities as a function of the Fermi-level position. We also investigate complexes of Fe with substitutional oxygen on the nitrogen site, with nitrogen vacancies and with hydrogen interstitials. In GaN and AlN, iron on the cation site is amphoteric. We discuss the role of the Fe-induced acceptor level and its impact on nonradiative recombination in the context of loss mechanisms in light emitters, and current collapse in high-electron-mobility transistors. In InN, we find the iron interstitial to be the most favorable configuration, where it acts as a shallow double donor.