We study and quantify the implications of voter bias and electoral competition for politicians' gender composition. Unfavorable voters' attitudes towards women correlate negatively with female candidates' share in Parliamentary elections. Using within-candidate variation, we find that female candidates obtain fewer votes in French municipalities with higher gender earnings gaps. We show theoretically that when voters are biased against women, parties facing gender quotas select male candidates in the most contestable districts. We find strong empirical support for such a strategic party response to voter gender bias. Simulating our calibrated model confirms that competition significantly hinders the effectiveness of gender quotas.