The passage of feces is called defecation.
It is begun voluntarily by contraction of the abdominal muscles. At the same time, the sphincter muscles of the anus relax, and there is a peristaltic contraction wave of the colon and rectum. Feces are expelled as a result of all these actions. Feces consist of undigested food residue, secretions from the digestive glands, bile, mucus, and millions of bacteria.
Mucus is derived from the many mucous glands that pour secretions into the intestine. Bacteria are especially numerous in the large intestine. They act upon food material, causing putrefaction of proteins and fermentation of carbohydrates. Although the bacteria normally in the large intestine serve a useful purpose internally, they are contaminants outside the intestine.