Pregnancy and/or the puerperium involve social, physiological and psychological changes that make women more vulnerable to mental disorders such as anxiety and depression, even more so if these develop in stressful contexts such as the pandemic. The aim of this study is to identify factors associated with the risk of postpartum anxiety and depression during the COVID-19 pandemic. A cross-sectional study was conducted among postpartum women (n= 69) who gave birth between March 2020 and March 2021 in Melilla, a Spanish cross-border city with Morocco whose borders were closed, making it a confined city. The scales used were the State-Trait Anxiety Inventory and the Edinburgh Postnatal Depression Scale. Results reported an elevated risk of depression (85.5%) and anxiety (63.8%), with severe anxiety reaching 40.6% of cases. Predictors of postpartum depression comprised a personal history of mood disorders (β= 8.421; CI95% = 4.863/11.978) and having been diagnosed with COVID-19 during pregnancy or postpartum (β= 4.488; CI95% = 1.331/7.646). As regards anxiety, it is predicted on the basis of mood antecedents (β= 14.175; CI95% = 7.870/20.479), the fact of having been diagnosed with COVID-19 during pregnancy or postpartum (β= 8.781; CI95% = 2.970/14.592) and the fact of being a multipara (β= 5.513; CI95% = 0.706/10.321). In conclusion, special attention should be paid to women with a history of mood disorders and a positive diagnosis of COVID-19 during pregnancy or postpartum, even more so in the case of multiparous women, because of its impact on mental health during the postpartum period.Supplementary InformationThe online version contains supplementary material available at 10.1007/s12144-023-04719-6.