This paper investigates the reasons behind the low representation of women among legislators. Using data from Spain, we find that parties tend to nominate female candidates to poorer positions on the ballot. We examine whether this is due to voter bias or party bias, and find two pieces of evidence supporting the latter: female candidates attract more votes, and political competition improves the quality of positions to which female candidates are assigned. Moreover, gender quotas fail to erode the strategic nomination of female candidates. The evidence in this paper helps explain why quotas in candidate lists might often lead to disappointing increases in the number of elected female politicians.