Submitted Currently, research on second language acquisition (SLA) and psychology of language learning has conceived foreign language learning as a complex system of beliefs, thoughts, emotions, and actions that contribute immensely to shape students’ learning experiences. The significance of such research lies in the fact that they provide a holistic perspective of FL learning by considering the multiple and interrelated interactions of beliefs, emotional and cognitive factors, rather than examining any single variable in isolation. Therefore, this study seeks to provide such insights by examining the interaction between perception of task difficulty and cognitive engagement in an EFL writing classroom, taking into consideration the possible effects of foreign language enjoyment (FLE) and mindset on such relationship. Data were collected from 218 Saudi undergraduate students using a questionnaire. Results revealed that: a) students’ perception of task difficulty is linked to their cognitive engagement; b) FLE acts as a buffer against the negative effects of difficult EFL writing tasks on students’ cognitive engagement; c) growth mindset has no moderating role in the relationship between perceived difficulty and cognitive engagement.