Statistical analysis
We performed all statistical analyses in R v3.4.3 with the package afex (Singmann et al. , 2015), a wrapper for lme4 (Bates et al. , 2011). We fit generalised linear mixed models (glmer) with the binomial family (logit link) on counts of either wild type or ebony flies (mating success experiment) or alive and dead flies (survival 72 hours post-infection after 14 generations of experimental evolution) from each vial. For the latter, we fit one model that included all the data (both male and female survival) and included effects of sexual selection, pathogen presence, sex, and all interactions. We also fit simpler models on sex-specific subsets of the data that excluded an effect of sex. In all models, we included experimental block, population, and vial (nested within population) as random effects.