Background. The frequency of erectile dysfunction (ED) complicating diabetes mellitus (DM) is reportedly high. However, its risk factors have not been well studied. Methods. This was a cross-sectional study of 160 male type 2 DM adults, aged 30–70 years, attending a tertiary healthcare clinic. Demographic and relevant clinical information was documented. Erectile function was assessed using an abridged version of the International Index of Erectile Function (IIEF-5). All subjects were evaluated for central obesity, glycemic control, peripheral arterial disease (PAD), autonomic neuropathy, dyslipidemia, and testosterone deficiency. Results. 152 (95%) patients with a mean age of 60.3 ± 8.8 years completed the study. 71.1% had varying degrees of ED, while 58.3% suffered from a moderate-to-severe form. Independent predictors of ED [presented as adjusted odds ratio (95% confidence interval)] were longer duration of DM, 1.14 (1.02–1.28), PAD, 3.87 (1.28–11.67), autonomic neuropathy, 3.51 (1.82–6.79), poor glycemic control, 7.12 (2.49–20.37), and testosterone deficiency, 6.63 (2.61–16.83). Conclusion. The prevalence of ED and its severe forms was high in this patient population. Poor glycemic control and testosterone deficiency were the strongest risk factors for ED, making it possibly a preventable condition.