The exact cause of ulcerative colitis is unknown, although it's thought to be the result of a problem with the immune system.
The immune system is the body's defence against infection. Many experts believe ulcerative colitis is an autoimmune condition (when the immune system mistakenly attacks healthy tissue).
The immune system normally fights off infections by releasing white blood cells into the blood to destroy the cause of the infection. This results in inflammation (swelling and redness) of body tissue in the infected area.
In ulcerative colitis, a leading theory is that the immune system mistakes "friendly bacteria" in the colon – which aid digestion – as a harmful infection, leading to the colon and rectum becoming inflamed.
Alternatively, some researchers believe a viral or bacterial infection triggers the immune system, but for some reason it doesn't "turn off" once the infection has passed and continues to cause inflammation.
It's also been suggested that no infection is involved and the immune system may just malfunction by itself, or that there's an imbalance between good and bad bacteria within the bowel.
It also seems inherited genes are a factor in the development of ulcerative colitis. Studies have found that more than one in four people with ulcerative colitis has a family history of the condition.
Levels of ulcerative colitis are also a lot higher in certain ethnic groups, further suggesting that genetics are a factor.
Researchers have identified several genes that seem to make people more likely to develop ulcerative colitis, and it's believed that many of these genes play a role in the immune system.
Where and how you live also seems to affect your chances of developing ulcerative colitis, which suggests environmental factors are important.
For example, the condition is more common in urban areas of northern parts of Western Europe and America.
Various environmental factors that may be linked to ulcerative colitis have been studied, including air pollution, medication and certain diets.
Although no factors have so far been identified, countries with improved sanitation seem to have a higher population of people with the condition. This suggests that reduced exposure to bacteria may be an important factor.