We investigate the atomic geometry, formation energies, and electronic structure of nitrogen occupying both arsenic and gallium sites in GaAs (N-As and N-Ga) using first-principles total-energy calculations. We find that both neutral defects induce impurity-like empty levels in the band gap acting as acceptors. While N-As shows a s-like a(1) level in the middle of the band gap, N-Ga shows a p-like t(2) level close to the bottom of the conduction band. The gap level of N-As gives theoretical support for the experimentally observed band-edge redshift on the GaAsN alloy for a N concentration similar to3%. Strong inward relaxations preserving the T-d symmetry characterize the N-As equilibrium geometry in all the charge states investigated. In contrast, N-Ga exhibits a structural metastability in neutral charge state and Jahn-Teller off-center distortions in negative charge states forming a negative-U center. Formation energies of competing N-As and N-Ga defects are also discussed. (C) 2001 American Institute of Physics.