Public schooling systems are an essential feature of modern states. These systems often developed at the expense of religious schools, which undertook the bulk of education historically and still cater to large student populations worldwide. This paper examines how Indonesia's longstanding Islamic school system responded to the construction of 61,000 public elementary schools in the mid-1970s. The policy was designed in part to foster nation building and to curb religious influence in society. We are the first to study the market response to these ideological objectives. Using novel data on Islamic school construction and curriculum, we identify both short-run effects on exposed cohorts as well as dynamic, long-run effects on education markets. While primary enrollment shifted towards state schools, religious education increased on net as Islamic secondary schools absorbed the increased demand for continued education. The Islamic sector not only entered new markets to compete with the state but also increased religious curriculum at newly created schools. Our results suggest that the Islamic sector response increased religiosity at the expense of a secular national identity. Overall, this ideological competition in education undermined the nation-building impacts of mass schooling.