During the COVID-19 pandemic, many countries used lockdowns as a containment measure. While lockdowns successfully contributed to slowing down the contagion, the related mobility restrictions were reportedly associated with an increased risk of major depressive and anxiety disorders. We aimed to quantify the trade-off between the quality-adjusted life years (QALY) gain due to lower COVID-19 incidence as a result of a lockdown and QALY loss due to lockdown-induced mental disorders. We developed an agent-based model of COVID-19 epidemic and coupled mental disorder development in the population of a large city. We used data sources on the places of living, studying and working, public health and census surveys. Modeling of mental disorders was based on diathesis-stress concept. We quantified mental and physical health burden in terms of QALY taking into account major depressive and anxiety disorder episodes, lethal and non-lethal cases of COVID-19, and immunization. We evaluated the dynamics of new major depressive disorder (MDD) and anxiety disorder (AD) cases during the period between September 2020 and December 2021 in Moscow, Russia. We found that lockdown imposition increases the daily chances of getting MDD or ADD by a vulnerable person by 16.79% (95% CI [12.36%, 21.23%]). The QALY loss associated with COVID-19-induced and lockdown-induced mental disorders was estimated to be 18.93% (95% CI [16.94%, 19.73%]) of the total QALY loss caused by COVID-19, immunization, and all kinds of mental disorders. For a synthetic "strong" lockdown, it had been shown that QALY loss is minimized when about 70% of the population are isolated. The burden associated with mental disorders amounts to a considerable part of COVID-19-related losses. Our findings demonstrate that cost-benefit analysis of mobility restriction should include a forecast of mental disorder development in the population.