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. Some 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 swelling and redness (inflammation) of body tissue in the infected area.
In ulcerative colitis, a 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 does not "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, or that there's an imbalance between good and bad bacteria within the bowel.
It also seems inherited genes may be a factor in the development of ulcerative colitis.
You may be more likely to have ulcerative colitis if you have a close relative with the condition.
Researchers have identified several genes that seem to make people more likely to develop ulcerative colitis.
It's believed 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, medicine 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.