ObjectiveIn early March 2022, the highly contagious Omicron variant rapidly emerged in Shanghai. This study aimed to explore the prevalence and associated factors of depression and anxiety in isolated or quarantined populations under lockdown.MethodsA cross-sectional study was conducted between May 12 and 25, 2022. The depressive and anxiety symptoms, perceived stress, self-efficacy and perceived social support in the 167 participants under isolated or quarantined were examined using the Patient Health Questionnaires-9 (PHQ-9), the Generalized Anxiety Disorder-7 (GAD-7), the Perceived Stress Scale-10 (PSS-10), the General Self-Efficacy Scale (GSES) and the Perceived Social Support Scale (PSSS). Data on demographic information were also collected.FindingsThe prevalence of depression and anxiety in isolated or quarantined populations was estimated to be 12 and 10.8%, respectively. Higher education level, being healthcare workers, being infected, longer duration of segregation and higher perceived stress level were identified as risk factors for depression and anxiety. Furthermore, the relationship between perceived social support and depression (anxiety) was mediated not only by perceived stress but also the chain of self-efficacy and perceived stress.ConclusionBeing infected, higher education level, longer duration of segregation and higher perceived stress were associated with higher levels of depression and anxiety among isolated or quarantined populations under lockdown. The formulation of psychological strategies that promote one’s perceived social support and self-efficacy as well as reduce perceived stress is supposed to be drawn.