The COVID-19 pandemic and lockdowns prompted a major concern for mental health effects. Comprehensive nationwide studies are lacking on the indirect effect of the COVID-19 pandemic on the population's mental health. We aimed to determine whether the COVID-19 pandemic and lockdowns affected mental health service usage, suicide attempts, and suicides. This comprehensive nationwide register-linked study followed all individuals in Denmark from 1990. The main outcomes were rates of psychiatric admissions, use of psychotropic medication, suicide attempts, suicides, patients in community-based private psychiatry or psychology practices, and referrals to psychiatric hospitals. The impact of the pandemic (March 11, 2020-June 30, 2023) and lockdowns was assessed with log-normal models adjusted for pre-pandemic trends (January 1, 2017-March 10, 2020). We reported Rate Ratios (RR) of the observed and counterfactual rates. We identified the 5 807 714 (50.3% females) individuals living in Denmark on March 1, 2020. The rates of psychiatric admissions (RR: 0.95, 95% Confidence Interval (CI): 0.91 to 0.99, p-value: 0.017) and suicide attempts (RR: 0.85, 95% CI: 0.76 to 0.95, p-value: 0.007) were lower during the pandemic compared to the pre-pandemic trend. The rates of suicides (RR: 0.89, 95% CI: 0.75-1.05, p-value: 0.173), patients in private practices (RR: 1.00, 95% CI: 0.96-1.04, p-value: 0.986), and referrals (RR: 1.06, 95% CI: 0.95-1.18, p-value: 0.307) were not significantly different during the pandemic compared to the pre-pandemic trend. During the first lockdown, rates were lower for psychiatric admissions (RR: 0.85, 95% CI: 0.80 to 0.90, p-value <0.001), suicide attempts (RR: 0.80, 95% CI: 0.69 to 0.94, p-value: 0.007), suicides (RR: 0.67, 95% CI: 0.52 to 0.86, p-value: 0.002), patients in private practices (RR: 0.88, 95% CI: 0.82 to 0.93, p-value <0.001), and referrals (RR: 0.69, 95% CI: 0.60 to 0.81, p-value < 0.001) compared to the pre-pandemic trend. However, during the pandemic, the rate of psychotropic medication users increased by 6% compared to the pre-pandemic trend (RR: 1.06, 95% CI: 1.05 to 1.06, p-value < 0.001). The COVID-19 pandemic and lockdowns did not severely influence pre-pandemic trends of the mental health burden in Denmark's population on a nationwide level.