No prospective study has analyzed simultaneously chronic viral hepatitis and alcoholism as risk factors for liver carcinogenesis, while taking into consideration the role of cirrhosis. Nor has the risk for hepatocellular carcinoma among patients with chronic viral hepatitis been prospectively evaluated in a low-risk Western population. Last, the relationship between hepatocellular carcinoma risk factors and bile duct cancer remains to be clarified. We analyzed prospectively the risk for primary liver and extrahepatic biliary tract cancer among 186,395 patients hospitalized with either chronic viral hepatitis, alcoholism, cirrhosis, or any combination of these conditions through linkages between national Swedish registers. Compared with the general population, the relative risk of hepatocellular carcinoma was 34.4 for chronic viral hepatitis alone, 2.4 for alcoholism alone, and 40.7 for cirrhosis alone. Among patients with combinations of these risk conditions, the relative risk of hepatocellular carcinoma was 27.3 for chronic viral hepatitis and alcoholism, 118.5 for chronic viral hepatitis and cirrhosis, 22.4 for alcoholism and cirrhosis, and 171.4 for all 3 conditions. We found limited evidence for an excess risk of intrahepatic, but not for extrahepatic, biliary duct cancer. Cirrhosis amplifies the risk of hepatocellular carcinoma among patients with chronic viral hepatitis, but it is not a prerequisite for liver carcinogenesis. In contrast, cirrhosis may be a necessary intermediate for the development of hepatocellular carcinoma among alcoholics.