There is concern that selective serotonin reuptake inhibitor (SSRI) treatment may increase the risk of suicide attempts or deaths, particularly among children and adolescents. However, debate remains regarding the nature of the relationship. Using nationwide Swedish registers, we identified all individuals aged 6-59 years with an incident SSRI dispensation (N = 538,577) from 2006 to 2013. To account for selection into treatment, we used a within-individual design to compare the risk of suicide attempts or deaths (suicidal behaviour) in time periods before and after SSRI-treatment initiation. Within-individual incidence rate ratios (IRRs) of suicidal behaviour were estimated. The 30 days before SSRI-treatment initiation was associated with the highest risk of suicidal behaviour compared with the 30 days 1 year before SSRI initiation (IRR = 7.35, 95% CI 6.60-8.18). Compared with the 30 days before SSRI initiation, treatment periods after initiation had a reduced risk-the IRR in the 30 days after initiation was 0.62 (95% CI 0.58-0.65). The risk then declined over treatment time. These patterns were similar across age strata, and when stratifying on history of suicide attempts. Initiation with escitalopram was associated with the greatest risk reduction, though CIs for the IRRs of the different SSRI types were overlapping. The results do not suggest that SSRI-treatment increases the risk for suicidal behaviour in either youths or adults; rather, it may reduce the risk. Further research with different study designs and in different populations is warranted.