Men who have sex with men (MSM) in South Africa remain at particular risk of HIV infection. The Ukwazana baseline survey is the first to explore this risk in relation to psychological factors associated with unprotected anal intercourse (UAI). A cohort of 316 MSM from township peri-urban Cape Town took part in the survey. The survey found that 55.2% had engaged in UAI over the preceding 6 months. Depression was significantly associated with UAI. Respondents with self-efficacy scores less than two standard deviations above the mean were also more likely to have engaged in UAI. A Sobel test for mediation highlighted that the depression-UAI association was partially mediated by self-efficacy, indicating that most of the effect of depression on UAI was not covarying with self-efficacy. This study, therefore, highlights that both depression and self-efficacy should be considered factors to be addressed in HIV-prevention programmes aimed at peri-urban MSM.