In this paper we present new evidence on the impact of school characteristics on secondary student achievement using a rich data set from rural Bangladesh. We deal with a potentially important selectivity issue in the South Asian context: the non-random sorting of children into madrasas (Islamic faith schools). We do so by employing a combination of fixed effects and instrumental variable estimation techniques. Our empirical results do not reveal any difference in test scores between religious and secular schools when selection into secondary school is taken into account. However, we document significant learning deficit by gender and primary school type: girls and graduates of primary madrasas have significantly lower test scores even after controlling for school and classroom-specific unobservable correlates of learning.