Abstract.Cancer is a multifactorial disease, and imbalances of the immune response and sex-associated features are considered risk factors for certain types of cancer. The present study aimed to assess whether ankylosing spondylitis (AS), an immune disorder that predominantly affects young adult men, is associated with an increased risk of cancer. Using the Taiwan National Health Insurance Research Database, a cohort of patients diagnosed with AS between 2000 and 2008 who had no history of cancer prior to enrollment was established (n=5,452). Age-and sex-matched patients without AS served as controls (n=21,808). The results revealed that the overall incidence of cancer was elevated in patients with AS [standardized incidence ratio (SIR), 1.15; 95% confidence interval (CI), 1.03-1.27]. AS carried an increased risk of hematological malignancy in both sexes, colon cancer in females and bone and prostate cancer in males. Young patients with AS (≤35 years) and patients with a Charlson comorbidity index (CCI) ≥2 experienced a higher incidence of cancer (males, SIR 1.92, and 95% CI 1.04-3.26; females, SIR 2.00 and 95% CI 1.46-5.50). The cancer risk was increased during the first 3 years following the diagnosis of AS (SIR 1.49, 95% CI 1.29-1.71), and overall cancer-free survival was significantly decreased in patients with AS patients of both sexes (P<0.0001). Therefore, AS was found to be associated with an increased risk of cancer. All AS patients must be screened for hematological malignancies, for prostate and bone cancer in males, and for colon cancer in females, particularly younger patients with a CCI ≥2.