People who see mucus in their stool are always scared and confused. They can understand diarrhea but mucus? It might sound surprising to know that this is happening for a good reason. It is trying to protect you.
This occurs in more advanced cases of inflammatory bowel conditions such as Ulcerative Colitis and Crohn’s. In these conditions, there is considerable damage to the intestinal wall as it is being assaulted by your digestive acids. As the damage gets deeper and close to making contact with nerve and blood tissue it attempts to protect you by releasing mucus into the bowel to stick to the wall to protect it from the acids. Because this is only a stop-gap measure the mucus eventually slides out along with the stool.
Do not ignore this, as it's a sign that you are losing control of the inflammation that is destroying your colon and are headed towards surgery.