For the first time, scientists have observed the distinct pattern of neuronal firing that occurs during a bowel movement – and it's not all in your head.

The enteric nervous system (ENS), aka your 'second brain', is a mesh network of millions of neurons that live inside and help control your gastrointestinal tract, and new research in mice shows how these 'brain cells' fire to make your colon do its thing.

"These findings identify a previously unknown pattern of neuronal activity in the peripheral nervous system," explains neurophysiology Nick Spencer from Flinders University in Australia.

The enteric nervous system is 'peripheral' in that it's separate from the central nervous system (CNS) we normally hear about, which is made up of the brain and the spinal cord.

Together, they help control and regulate the majority of our bodily activity, but the second brain is no slouch itself, with its own neural circuits that not only communicate with the CNS but also help the ENS control the digestive tract autonomously.

"It is really a brain of its own," Spencer told ScienceAlert, pointing out some research actually suggests the ENS could be considered our 'first brain' from an evolutionary perspective.

"The unique feature of the GI tract is that it is the only internal organ with its own complete nervous system that can operate totally independently of the brain and/or spinal cord."

How that system operates in mammals just got clearer, thanks to the team's new study examining the colons of euthanised mice.

The ENS of a mouse colon contains approximately 400,000 individual neurons, according to the researchers.

"One of the great mysteries of the gastrointestinal tract," Spencer explains, "is how such a large populations of enteric neurons (that lie within the gut wall) actually fire action potentials to generate contractions of the smooth muscle cells, enabling propulsion of colonic content."

Using high resolution neuronal imaging and electrodes to record electrical impulses from the animals' smooth muscle tissue, the researchers detected a rhythmic pattern of neuronal firing involving millions of cells that promote muscle contraction in the intestine, propelling waste through the body.

"This represents a major pattern of neuronal activity in the mammalian peripheral nervous system that has not previously been identified," the authors write.

"The synchronised ENS activity involved simultaneous activation of large populations of excitatory and inhibitory neurons, as well as putative intrinsic sensory neurons."

While rhythmic, synchronised neuron firing like this has been observed before in the CNS, the detection of these repetitive bursts in the ENS is new, and it adds to our understanding of how our second brain gets its 'thinking' done – even if it might seem like a somewhat unglamorous area of research.

"Too often in medicine there is a demand to cure disease, without understanding how the organ in question actually works," Spencer says.

"Until this new study no one had any idea exactly how large populations of neurons in the ENS lead to contraction of the intestine.

"Now that we know how the ENS is activated under healthy conditions… we can use this as a blueprint to understand how dysfunctional neurogenic motor patterns may arise along the colon. Chronic constipation affects a large proportion of the community worldwide, and often arises because of improper colonic transit."

The findings are reported in JNeurosci.

Editor's note: Article updated on 30 May 2018 with comments from Nick Spencer.