Why did America introduce compulsory schooling laws at a time when financial investments in education and voluntary school attendance were high? We provide qualitative and quantitative evidence that states adopted compulsory schooling laws as a nation-building tool to instil civic values to the culturally diverse migrants during the 'Age of Mass Migration' between 1850 and 1914. We show the adoption of compulsory schooling laws occurred significantly earlier in states that hosted European migrants with lower exposure to civic values in their home countries. Using cross-county data, we show that these migrants had significantly lower demand for American schooling precompulsion.