We study whether legal restrictions on prenatal discrimination against females leads to a shift by parents towards postnatal discrimination. We exploit the staggered introduction of a ban on sex-selective abortions across states in India to find that a legal restriction on abortions in India led to an increase in the number of females born, as well as a widening in the gender gap in educational attainment. Females born in states affected by the ban are 2.3, 3.5 and 3.2 percentage points less likely to complete Grade 10, complete Grade 12 and enter university relative to males. These effects are concentrated among non-wealthy households that lacked the resources to evade the ban. Investigating mechanisms, we find that the relative reduction in investments in female education were not driven by family size but because surviving females were now relatively unwanted. Discrimination is amplified among higher order births and among females with relatively few sisters. Finally, these negative effects exist despite the existence of a marriage market channel through which parents increase investments in their daughters' education to increase the probability that they make a high-quality match.