Theories for the evolution of sex rarely include facultatively sexual reproduction. Sexual harassment by males is an underappreciated factor: it should at first sight increase the relative advantage of asexual reproduction by increasing the cost of sex. However, if the same females can perform either sexual or asexual life cycles, then females trying to reproduce asexually may not escape harassment. If resisting male harassment is costly, it might be beneficial for a female to accept a mating and undertake a sexual life cycle rather than ‘insist’ on an asexual one. We investigate the effects of sexual harassment on the maintenance of sex under different population densities. Our model shows that resisting matings pays off at low population densities, which leads to the complete extinction of males, and thus to the evolution of completely asexual populations. Facultative sex persists in a narrow range of slightly higher densities. At high densities, selection favours giving up resisting male mating attempts and thus sexual reproduction takes over. These interactions between the outcomes of sexual conflict and population density suggest an explanation for the rarity of facultative sex and also patterns of geographical parthenogenesis, where marginal environments with potentially low densities are associated with asexuality.