---
abstract: 'When exposed to the high energy X-ray and ultraviolet radiation of a very active star, water vapor in the upper atmospheres of planets can be photodissociated and rapidly lost to space. In this paper, I study the chemical, thermal, and hydrodynamic processes in the upper atmospheres of terrestrial planets, concentrating on water vapor dominated atmospheres orbiting in the habitable zones of active stars. I consider different stellar activity levels and find very high levels of atmospheric escape in all cases, with the outflowing gas being dominated by atomic hydrogen and oxygen in both their neutral and ion forms. In the lower activity cases, I find that the accumulation of O$_2$ and increases in the D/H ratios in the atmospheres due to mass fractionation are possible, but in the higher activity cases no mass fractionation takes place. Connecting these results to stellar activity evolution tracks for solar mass stars, I show that huge amounts of water vapor can be lost, and both the losses and the amount of O$_2$ that can be accumulated in the atmosphere depend sensitively on the star’s initial rotation rate. For an Earth-mass planet in the habitable zone of a low-mass M-dwarf, my results suggest 