OBJECTIVES: The interactions of anxiety, depression, and the quality of life (QOL) in people with epilepsy (PWE) are unclear. This research aimed to explore how anxiety and depression interact to influence QOL. METHODS: The QOL, anxiety and depression of 1162 PWE were investigated via questionnaires and 849 of PWE were finally used in the statistical analyses. Mediation analysis was conducted to analyzed the mediating effect of depression in the relationship between anxiety and QOL. RESULTS: 849 PWE with a mean age of 46.62 ± 14.01 (range, 18-85) years were included finally, and 61.2 % were male. Mediation analysis revealed that depression indirectly mediated the relationship between anxiety and QOL (B = -0.445, bootstrap 95 % CI = -0.497 to -0.394). On the total score and the six out of seven domains of QOLIE-31 (seizure worry, overall QOL, emotional well-being, energy/fatigue, cognitive function, and social function), the indirect effect of depression (range, 51.0 %-68.9 %) are exceeded the direct effect of anxiety. Concerning the "medication effect", the indirect effect (36.0 %) of depression is smaller. CONCLUSIONS: The effect of anxiety on QOL is mainly explained by the partial mediation of depression. Specifically, anxiety primarily affects QOL through the effect of depression on the total QOL score and the other six domains. However, the direct effect of anxiety was stronger for the medication effect domain.