Ankylosing spondylitis (AS) is a common immune-mediated arthropathy primarily affecting the spine and pelvis. Most AS patients have subclinical intestinal inflammation, suggesting the gut microbiome and the immune response play a role in pathogenesis. Susceptibility to AS is primarily genetic, and at least 114 susceptibility variants have been identified to date. We applied bioinformatic methods utilizing epigenetic and gene and protein expression data to identify the cell types through which AS-associated variants operate. Variants were enriched in transcriptionally regulated regions in monocytes, CD4+ and CD8+ T cells, natural killer cells, regulatory T cells and B cells and mucosa from the small intestine, sigmoid colon and rectum. Weak signals were detected in bone cells, consistent with bone disease being a secondary manifestation. RNA sequencing of blood cells from AS patients and controls identified differentially expressed genes. Interrogation of expression databases showed that the upregulated genes were enriched in monocytes and downregulated genes were enriched in CD8+ T cells and natural killer cells. Gene Ontology term enrichment analysis identified microbes and the gut in the aetiology of AS. These findings identify the key immune cell types that drive the disease, and further highlight the involvement of the gut microbiome in the pathogenesis of AS.