Background: Injecting drug users (IDUs) and prisoners are considered to be highly vulnerable to human immunodeficiency virus (HIV) infection in Iran. This study was carried out to determine the prevalence of HIV infection among IDUs released from jail in Bahar (Hamadan, Iran). Methods: In a cross-sectional study, 118 IDUs who were prisoners during 2001-07 were evaluated. Their demographic and personal characteristics were assessed by a questionnaire. In order to determine HIV-positive individuals, blood samples were obtained from the participants and tested by enzyme-linked immunosorbent assay and Western blot technique. Findings: Overall, 20.3% of the subjects had used non-sterile injecting equipment during their imprisonment. The prevalence of HIV infection among the studied population was 4.2%. Conclusion: As the prevalence of HIV among IDUs released from jail is high, it is necessary for prison authorities to take measures against the increase in the prevalence of HIV among this group.Keywords: Injection drug users, Acquired immunodeficiency syndrome, Human immunodeficiency virus, Bahar (Iran).