This paper goes further in the discussion on the determinants of school attainment in developing countries. To properly estimate the effects of school resources on academic achievement, we need to take into account the large geographical inequalities in the distribution of school resources and the supply constraints faced by students living in poor areas. We do so by implementing a two-step correction that accounts for the constraints in school choice. Our findings suggest that failing to account for these constraints leads to an underestimation of the effect of school resources on school achievement of about 100%. This underestimation is particularly important for girls and in Math. Additionally, the contribution of school resources in explaining the gap in test scores between rich and poor students is doubled once we account for the constrained choices.