To assess the relative importance of ulcerative and non-ulcerative sexually transmitted disease in the transmission of HIV, a seroprevalence study was conducted on 2210 patients at the sexually transmitted diseases (STD) clinic of the S. Maria e S. Gallicano Hospital in Rome, between 1989 and 1994. Among male patients, by univariate analysis, strong predictors of HIV infection were homosexuality, sexual exposure to a HIV-positive partner, hepatitis B virus infection, and positive syphilis serology. An increased risk was estimated for patients with past genital herpes (odds ratio (OR) 3.86, 95% confidence intervals (CI) 0.40-18.2), and primary syphilis (OR 5.79, 95% CI 0.59-28.6). By multivariate analysis, a positive association was found with homosexuality (OR 6.9, 95% CI 2.9-16.5), and positive syphilis serology (OR 3.5, 95% CI 1.3-9.2). An adjusted OR of 2.41 was calculated for current and/or past genital herpes. These results, although not conclusive, suggest a role of ulcerative diseases as risk factors for prevalent HIV infection, and indicate that positive syphilis serology is an unbiased criterion for identifying individuals at increased risk of HIV infection.