What are the consequences of religious obligations conflicting with civic duties? We investigate this question by evaluating changes in the performance of practicing Muslim students when end-of-secondary-school exams and Ramadan overlapped in the Netherlands. Using administrative data on exam takers and a machine learning model to individually predict fasting probability, we estimate that the grades and pass rate of compliers dropped significantly. This negative impact was especially strong for low achievers and those from religiously segregated schools. Investigating mechanisms, we find evidence that not being able to sleep in the morning before an afternoon exam was particularly detrimental to performance.