To identify risk factors associated with a first episode of Clostridium difficile-associated diarrhoea (CDAD) in patients with HIV infection. A case-control study. University teaching hospital HIV inpatient unit. Nineteen HIV-infected patients with CDAD, defined as diarrhoea with positive stool culture for Clostridium difficile (CD) and positive stool cytotoxin B assay, were compared with 38 randomly selected controls (HIV-infected patients hospitalized on the ward on the day the matched case was diagnosed). CD isolates were phenotyped by electrophoretic protein patterns. The incidence of CDAD among HIV-infected patients was 4.1/100 of patient-admissions. On univariate analysis, cases were more likely to have used clindamycin [11 out of 19 compared with four out of 38; odds ratio (OR) 19; 95% confidence interval (CI), 2-160; P = 0.0007], and pyrimethamine (14 out of 19 compared with 13 out of 38; OR, 4.8; 95% CI, 1.4-16, P = 0.02) in the month before diagnosis, and to have had cerebral toxoplasmosis (12 out of 19 compared with 13 out of 38; OR, 2.8; 95% CI, 0.9-8.6; P = 0.09). There was also a significant increase of the risk of CDAD as duration of hospitalization in the ward increased (chi 2 for trend, P = 0.007). Multivariate models associated two risk factors with CDAD: clindamycin use (OR, 42; 95% CI, 2-813; P = 0.01), and prolonged hospitalization in the ward (OR, 3.6 per week in the ward; 95% CI, 1-13, P = 0.048). Of 18 available CD isolates, 15 (83%) had identical electrophoretic protein pattern. Clindamycin use and prolonged hospitalization in the ward were the main risk factors associated with CDAD in this study. These observations, together with the occurrence of one major phenotype of CD, suggest nosocomial transmission of CD in the ward.