Stress alters the digestive system as well as the brain, impacting stress-related disorders like depression, anxiety and irritable bowel syndrome. So if you are feeling depressed or anxious, a tweak to your diet may help lessen those feelings. All it takes is adding a little more fiber.

Friendly bacteria in the digestive tract break down the food you eat and produce the main source of nutrition for cells in this part of the body — short-chain fatty acids (SCFAs). They also help guard against irritable bowel syndrome. Eating a lot of high-fiber foods, such as fruits, vegetables, legumes and whole grains, increases the production of short-chain fatty acids, defending the body against the ravages of stress.

Mice fed SCFAs showed lower levels of stress and anxiety-related behaviors. They also had less undigested food, bacteria and germs “leaking” into the blood, causing inflammation.

Stress tends to upset the barrier between the inside of the digestive tract and the body, making the colon “leaky,” and allowing undigested particles of food as well as bacteria and germs to pass into the blood, causing continual inflammation.

Researchers at University College Cork fed mice the primary SCFAs that are normally produced by bacteria in the digestive tract. The mice were then subjected to stress and assessed for behavioral disorders, cognition and sociability. They also measured how easily food passed through the barrier of the digestive tract.

The mice fed short-chain fatty acids showed lower levels of stress and anxiety-related behaviors. Treatment with SCFAs also lessened “leakiness” of particles into the bloodstream from the colon.

“There is a growing recognition of the role of gut bacteria and the chemicals they make in the regulation of physiology and behavior,” explained researcher, John F. Cryan of University College Cork, in a statement. “The role of short-chain fatty acids in this process is poorly understood up until now.”

Dietary treatments that target these bacteria could be beneficial in the treatment of stress-related disorders and irritable bowel syndrome. The results provide new information about the role of friendly bacteria play in the digestive system and their impact on the brain and behavior.

So have an apple, a piece of whole grain bread or salad. Fiber-rich foods — whole grains, fruits and vegetables, and legumes — might be the easiest way yet to put a dent in your stress or lessen depression. It sure can’t hurt.

The study was published in The Journal of Physiology.