Purpose It is not known whether the elevated suicide risk in certain occupations, such as health care professionals, is partly attributable to a selection of individuals with prior vulnerability. We aimed to determine the risk of suicide and self-harm already in students entering different university programs. Methods We used national registers to identify 621,218 Swedish residents aged 18–39 years with registration for a university program 1993–2013. Outcomes were suicide and self-harm within three years. We applied logistic regression analyses to calculate odds ratios (OR) and 95% confidence intervals (CI) of risk of suicide and self-harm, with the Education program category as a reference. Results were adjusted for sex, age, time period and for history of hospitalization due to mental disorder or self-harm, as a measure of previous vulnerability. In the second step, we stratified results by sex. Results There was a higher risk of suicide (OR 2.4) in female nursing students and natural science students (OR 4.2) and of self-harm in female and male Nursing/Health care students (OR range 1.2 –1.7). Subcategorization into nursing students only strengthened the association with self-harm for both sexes. Prior vulnerability did not fully explain the increased risk. Conclusion The elevated risk of suicide in nursing and health care occupations partly has its onset in vulnerability factors present before or emerging during university studies. Increased efforts in identifying and treating mental disorders and preventing self-harm in university students could be an important step in preventing future suicides.