Scientists have discovered why humans have an appendix – the small, thin tube attached to the large intestine whose purpose has long been a mystery.

The appendix is prone to painful inflammation, known as appendicitis, and sometimes has to be surgically removed.

It is usually considered a pointless, vestigial organ, but may actually serve as a reservoir for beneficial gut bacteria, according to researchers at Midwestern University in the US state of Arizona.

Associate Professor Heather Smith studied the intestines and environmental characteristics of 533 different mammals as part of their research into the evolution of the appendix.

Some animals, including primates, wombats and rabbits, have an appendix, while others, such as dogs and cats, do not.

They discovered the appendix had evolved 30 separate times in different species, and almost never disappeared from an evolutionary lineage once it had appeared.

Inspiring body positivity quotes Show all 12 1 /12 Inspiring body positivity quotes Inspiring body positivity quotes Ashley Graham "And cellulite, I have not forgotten about you. I'm going to choose to love you even though you want to take over my whole bottom half. You're a part of me and I love you." Inspiring body positivity quotes Danielle Brooks "Sometimes I don't like what I see, but I have the power to change the way in which I relate to my body both physically and mentally." Inspiring body positivity quotes Iskra Lawrence "Stop comparing yourself to anybody else. The [pictures of] movie stars, even the Disney characters, that’s not real. That’s not attainable. You can’t be anybody else. You are you. You can’t be them. So you really just have to start embracing yourself and accepting so-called flaws that society has given the name ‘flaws’. It’s just our body, our patchwork quilt.” Inspiring body positivity quotes Beyoncé "The most alluring thing a woman can have is confidence." Getty Images Inspiring body positivity quotes Kate Winslet "Nobody is perfect. I just don't believe in perfection. But I do believe in saying, 'This is who I am and look at me not being perfect.' I'm proud of that." Getty Images Inspiring body positivity quotes Rihanna "You just want something that someone else has, but that doesn't mean what you have isn't beautiful, because people always want what you have and you always want what they have - no one is ever 100 per cent like, 'Yes, I'm the bomb-dot-com - from head-to-toe!" REUTERS Inspiring body positivity quotes Tess Holliday "Never compare yourself with others and celebrate what makes you, you." Inspiring body positivity quotes Demi Lovato "Instead of looking in the mirror and focusing on your flaws, look in the mirror and appreciate your best features... everyone has them." Inspiring body positivity quotes Kim Kardashian-West "See this little dimple of cellulite here? It was so worth it for that cookies 'n' cream ice cream!" Inspiring body positivity quotes Jennifer Lawrence "It should be illegal to call someone fat." Inspiring body positivity quotes Mindy Kaling "Insults about the way I look can’t be the thing that harms me and my heart the most. It has to harm me the least. If I have a daughter, I’m going to tell her that. Far too many women are much more hurt by being called fat or ugly than they are by being called not smart, or not a leader." Rex Features Inspiring body positivity quotes Selena Gomez "I’m learning that you can be comfortable and still look beautiful.” AFP/Getty Images

Animals with an appendix have a higher concentration of lymphoid tissue in their gut, which plays an important role in the immune system, the scientists found.

This tissue can stimulate growth of some types of beneficial bacteria, which can be stored in the appendix, so it is not all lost if the creature suffers an attack of diarrhoea, it is believed.

Associate Professor Smith said it may take people who have had their appendix removed "slightly longer to recover from illness, especially those in which the beneficial gut bacteria has been flushed out of the body," according to Time magazine.

An average adult appendix is five to ten centimetres long and around six to eight millimetres in diameter.

Around 40,000 people are admitted to hospital with appendicitis, the dangerous swelling of the appendix, in England each year.