Statins have shown both protective and adverse associations with neuropsychiatric outcomes. We aimed to examine the possible associations between statins and suicidality, depression, anxiety, and seizures.Using Swedish national registers, we linked data on dispensed statin prescriptions with data on unplanned (emergency) hospital visits or specialised outpatient care for four neuropsychiatric outcomes: suicidal behaviour (including deaths from suicide), depressive disorders, anxiety disorders, and seizures. We included all individuals in the registries who were dispensed statins and who were aged 15 years or older between Jan 1, 2006, and Dec 31, 2013. We applied a within-individual design using stratified Cox proportional hazards regression to compare the incidence of the defined outcomes during periods on statins and periods off statins within each individual, thus adjusting for time-invariant confounders. Non-specific effects of treatment were tested by investigating these outcomes in relation to thiazide diuretic use and antihistamine use in the same cohort.The statin-users cohort comprised 1 149 384 individuals, of whom 1 015 949 (88·4%) were aged 50 years or older, 625 616 (54·4%) were male, and 523 768 (45·6%) were female. The study period consisted of 2 053 310 non-treatment periods and 2 997 545 treatment periods, and 957 216 (83·3%) individuals had a medication status change (from on statins to off statins, or vice versa). Suicide outcomes were found in 6372 (0·6%) individuals, depressive disorders in 23 745 (2·1%), anxiety disorders in 30 100 (2·6%), and seizures in 28 844 (2·5%). There were no clear associations between periods of statin treatment and suicidal behaviour or deaths from suicide (hazard ratio 0·99 [95% CI 0·90-1·08]), anxiety disorders (0·99 [0·95-1·02]), or seizures (1·00 [0·97-1·04]). Statins were associated with reduced hazards of depressive disorders (0·91 [0·87-0·94]), which remained after adjustment for concurrent antidepressant use (0·91 [0·88-0·94]). Hazard ratios for depressive disorders were 0·61 (0·38-1·00; n=14 718) with thiazide diuretic use and 0·84 (0·67-1·06; n=23 715) with antihistamine use.Statin use is not associated with suicidality, anxiety disorders, or seizures. Whether the observed association between statin use and reduced diagnoses of clinical depression is confounded by non-specific benefits related to being prescribed medication needs further research.Wellcome Trust, Swedish Research Council, National Institute for Health Research (NIHR) Research Professorship, NIHR Oxford Health Biomedical Research Centre, American Foundation for Suicide Prevention, Karolinska Institutet.