Background and aims: Despite the growing epidemic of suicide among college students, the associated risk factors have not been properly understood in developing countries. This study was conducted to estimate the prevalence of suicide ideation and attempt and associated risk factors among university students. Methods: We performed this cross-sectional study in the Hamadan University of Medical Sciences from January to May, 2016, and invited university students to participate voluntarily in the study. The outcomes of interest were suicide ideation and attempt. The exposures of interest were behavioral risk factors, including having girlfriends/boyfriends, emotional breakdown (also known as mental breakdown), illegitimate heterosexual and/or homosexual intercourse, cigarette smoking, drug abuse, psychiatric disorders, and social media. Results: Of 1254 participants, 146 (11.7%) had suicidal ideation during the past year and 63 (5.0%) had attempted suicide at least once in the past year. After adjusting the odds ratio (OR) (95% CI) for age and sex, it was found that suicide ideation was significantly associated with emotional breakdown 2.33 (1.64, 3.31), heterosexual intercourse 2.71 (1.77, 4.15), homosexual intercourse 3.21 (1.97, 5.25), cigarette smoking 4.03 (2.65, 6.11), drug abuse 12.09 (7.97, 18.35), psychiatric disorders 12.48 (7.59, 20.53), no interest in the discipline 2.08 (1.40, 3.07), and despair about the future 2.18 (1.49, 3.19). There was no significant association between suicide ideation and using social media 1.13 (0.65, 1.96). Conclusion: This study provided beneficial information about the association between suicidal ideation and attempted suicide and some behavioral risk factors among university students and emphasized the importance of these modifiable risk factors which if neglected, may severely impair the students' function.