We use a difference-in-differences model with individual fixed effects to evaluate a 1999 Spanish law granting employment protection to workers with children younger than 6 who had asked for a shorter workweek due to family responsibilities. Our analysis shows that well- intended policies can potentially backfire and aggravate labor market inequalities between men and women, since there is a very gendered take-up, with only women typically requesting part-time work. After the law was enacted, employers were 49% less likely to hire women of childbearing age, 40% more likely to separate from them, and 37% less likely to promote them to permanent contracts, increasing female non-employment by 4% to 8% relative to men of similar age. The results are similar using older women unaffected by the law as a comparison group. Moreover, the law penalized all women of childbearing age, even those who did not have children. These effects were largest in low-skill jobs, at firms with less than 10 employees, and in industries with few part-time workers. These findings are robust to several sensitivity analyses and placebo tests.