Research has shown more than 9 out of 10 people with AS carry a particular gene known as human leukocyte antigen B27 (HLA-B27).
Having this gene does not necessarily mean you'll develop AS. It's estimated 8 in every 100 people in the general population have the HLA-B27 gene, but most do not have AS.
It's thought having this gene may make you more vulnerable to developing AS. The condition may be triggered by 1 or more environmental factors, although it's not known what these are.
Testing for this gene may be carried out if AS is suspected. However, this test is not a very reliable method of diagnosing the condition because some people can have the HLA-B27 gene but not have ankylosing spondylitis.
Read about how ankylosing spondylitis is diagnosed.
Can ankylosing spondylitis be inherited?
AS can run in families, and the HLA-B27 gene can be inherited from another family member.
If you have AS and tests show you carry the HLA-B27 gene then there is a 1 in 2 chance that you could pass on the gene to any children you have. It is estimated that between 5 to 20% of children with this gene will then go on to develop AS.