Heroin users from Guangxi province, a southern province of China that borders Vietnam in the south and Yunnan province in China in the west, were studied for prevalence and risk factors for HIV-1 infection. Viral env sequences from HIV-1-positive individuals were also determined for subtypes of HIV-1. The overall HIV prevalence among 227 heroin users was 40%. Most had used drugs for < or = 3 years. Sharing of injection equipment and unprotected sex were significantly associated with HIV-1 infection. Subtypes C and E HIV-1 were detected in infected heroin users and were sharply segregated in two geographic locations: only subtype C was found in a border city with Yunnan province, whereas only subtype E was found in a city bordering northern Vietnam. HIV-1 strains within each subtype were remarkably homogenous, with a mean intersubject DNA distance of 2.32% for subtype E and 1.13% for subtype C, respectively. Phylogenetic analysis of C2-V5 region of Guangxi subtype E env sequences revealed significant clustering with subtype E sequences from southern Vietnam and Cambodia. These results suggest that HIV-1 infection among heroin users in Guangxi represents two emerging epidemics initiated from distinct sources: one from Vietnam and another from Yunnan province. Factors associated with HIV-1 infection were not restricted to injection practices. Unprotected sexual behaviors are likely to increase the probability of HIV transmission beyond this high-risk population. Designing and implementing effective intervention strategies targeted toward both injection drug use and high risk sexual behavior are urgently needed to further reduce HIV-1 spread in China.