To elucidate the risk factors for anal cancer, we interviewed and obtained blood specimens from 148 persons with anal cancer and from 166 controls with colon cancer in whom these diseases were diagnosed during 1978-1985. We found that in men, a history of receptive anal intercourse (related to homosexual behavior) was strongly associated with the occurrence of anal cancer (relative risk, 33.1; 95 percent confidence interval, 4.0 to 272.1). Anal intercourse was only weakly associated with the risk of anal cancer in women (relative risk, 1.8; 95 percent confidence interval, 0.7 to 4.2). Among the subjects with squamous-cell anal cancer, 47.1 percent of homosexual men, 28.6 percent of heterosexual men, and 28.3 percent of women gave a history of genital warts, as compared with only 1 to 2 percent of controls and no patients with transitional-cell anal cancer. In patients without a history of warts, anal cancer was associated with a history of gonorrhea in heterosexual men (relative risk, 17.2; 95 percent confidence interval, 2.0 to 149.4) and with seropositivity for herpes simplex type 2 (relative risk, 4.1; 95 percent confidence interval, 1.9 to 8.8) and Chlamydia trachomatis (relative risk, 2.3; 95 percent confidence interval, 1.1 to 4.8) in women. Current cigarette smoking was a substantial risk factor in both women (relative risk, 7.7; 95 percent confidence interval, 3.5 to 17.2) and men (relative risk, 9.4; 95 percent confidence interval, 2.3 to 38.5). We conclude that homosexual behavior in men is a risk factor for anal cancer, and that squamous-cell anal cancer is also associated with a history of genital warts, an association suggesting that papillomavirus infection is a cause of anal cancer. Certain other genital infections and cigarette smoking are also associated with anal cancer.