Calculations of the statistical equilibrium of magnesium in the solar photosphere have shown that NLTE populations hardly affect Mg line formation in the Sun . However , in metal-poor dwarfs and giants the influence of electron collisions is reduced , and the ultraviolet radiation field , enhanced due to reduced background line opacity , results in more pronounced NLTE effects . In the photosphere of a cool star excitation and ionization due to collisions with neutral hydrogen can outweigh electron collisions . Analyses based on NLTE populations lead to significantly higher Mg abundances than those calculated from LTE . We calculate magnesium abundances in 10 cool dwarfs and subgiants with metallicities from -2.29 to 0.0 . The results are based on spectra of high-resolution and high signal-to-noise ratio . Stellar effective temperatures are derived from Balmer line profiles , surface gravities from Hipparcos parallaxes and the wings of the Mg i b triplet , and metal abundances and microturbulence velocities are obtained from LTE analyses of Fe ii line profiles . For stars with metallicities between -2.0 < [ Fe/H ] < -1.0 abundance corrections \Delta { [ Mg / H ] _ { NLTE - LTE } } \sim 0.05 - 0.11 are found . As expected the corrections increase with decreasing metal abundance , and they increase slightly with decreasing surface gravity . We also calculate the statistical equilibrium of magnesium for series of model atmospheres with different stellar parameters and find that \Delta { [ Mg / H ] _ { NLTE - LTE } } increases with effective temperature between 5200 and 6500 K. For extremely metal-poor stars the abundance corrections approach \Delta { [ Mg / H ] _ { NLTE - LTE } } \sim 0.23 at [ Fe/H ] \sim - 3.0 .