We use observations from the Mars Atmosphere and Volatile EvolutioN(MAVEN) mission to show how superthermal electron fluxes and crustal magnetic fields affect ion densities in the nightside ionosphere of Mars. We find that, due to electron impact ionization, high electron fluxes significantly increase the , O+, and densities below 200 km, but only modestly increase the NO+ density. High electron fluxes also produce distinct peaks in the , O+, and altitude profiles. We also find that superthermal electron fluxes are smaller near strong crustal magnetic fields. Consequently, nightside ion densities are also smaller near strong crustal fields because they decay without being replenished by electron impact ionization. Furthermore, the ratio is enhanced near strong crustal fields because, in the absence of electron impact ionization, is converted into NO+ and not replenished. Our results show that electron impact ionization is a significant source of , O+, and in the nightside ionosphere of Mars.