A seroepidemiological study of HIV-1 infection was carried out among all the subjects who were imprisoned in a correctional centre in Catalonia (Spain) between October 1987 and April 1988. Six hundred and thirty-one inmates (male, mean age 19.1 +/- 1.7 years) were surveyed. The overall prevalence of HIV-1 infection was 33.6%. Statistically significant differences were observed between intravenous drug users (IVDUs) and non-IVDUs (P less than 0.0000001) and between regular and irregular IVDUs (P less than 0.000001). The age at which the person started using drugs and the length of time spent in prison were also significantly associated with the prevalence of infection. No other variables, except the higher prevalence among the gipsy ethnic group, showed any statistically significant association with HIV-1 infection.