The effect of introducing nitrogen and oxygen in the sputtering working gas on the magnetic properties of Mn:ZnO thin films has been investigated. A set of films has been characterized by X-ray diffraction, X-ray absorption near edge structure (XANES) and optical absorption spectroscopy to correlate its magnetic properties with Mn electronic characteristics. Mn2+ substituting Zn2(+) in the wurtzite structure has been obtained for the films presenting considerably high saturation magnetization values. The change in the magnetic behaviour seems to be associated with the electronic carrier density in the films. (C) 2009 Elsevier B.V. All rights reserved.