Abstract: We used data from the Scottish Veterans Health Study to examine long-term mental health outcomes in a large cohort of veterans, with a focus on the impact of length of service. We conducted a retrospective, 30-year cohort study of 56,205 veterans born 1945-1985, including 14,702 who left prematurely, and 172,741 people with no record of military service, using Cox proportional hazard models, to examine the association between veteran status, length of service and cumulative risk of mental health disorder. We stratified the veterans by common lengths of service, defining ‘early service leavers’ as those who had served for less than 2.5 years. There were 2,794 (4.97%) first episodes of any mental health disorder in veterans, compared with 7,779 (4.50%) in non-veterans. The difference was statistically significant for all veterans (adjusted HR 1.21, 95% CI 1.16-1.27, P<0.001). Sub-group analysis showed the highest risk to be in early service leavers (adjusted HR 1.51, 95% CI 1.30-1.50, P<0.001), including those who failed to complete initial training. The risk reduced with longer service; beyond nine years’ service, it was comparable to or lower than nonveterans. The veterans at highest risk of mental health disorder were those who did not complete training or minimum engagement, whilst those with longest service were at reduced risk, suggesting that military service was not causative. The high risk among the earliest leavers may reflect pre-service vulnerabilities not detected at recruitment, which become apparent during early training and lead to early discharge.