The ab initio self-interaction-corrected local-spin-density approximation is used to study the electronic structure of both stoichiometric and non-stoichiometric nickelates. From total energy considerations it emerges that, in their ground-state, both LiNiO2 and NaNiO2 are insulators, with the Ni ion in the Ni3+ low spin state (6t2g 1eg) configuration. It is established that a substitution of a number of Li/Na atoms by divalent impurities drives an equivalent number of Ni ions in the NiO2 layers from the JT-active trivalent low-spin state to the JT-inactive divalent state. We describe how the observed considerable di_erences between LiNiO2 and NaNiO2 can be explained through the creation of Ni2+ impurities in LiNiO2. The indications are that the random distribution of the Ni2+ impurities might be responsible for the destruction of the long-range orbital ordering in LiNiO2.