Bacteria communicate with one another in a similar way to nerve cells in the brain, scientists have discovered.
The bugs "talk" by means of electrical signals allowed to pass in and out of their bodies by gate-keeper "ion channel" proteins.
Researchers in the US conducted an experiment that showed how a colony of bacteria acted in a co-ordinated fashion when it reached a certain size.
Microbes at the outer edge of the "biofilm" colony consisting of hundreds of thousands of bugs had unrestricted access to nutrients while those at the centre were at risk of going hungry.
To overcome this problem, the outlying bacteria periodically stopped growing to allow nutrients to flow to the centre. This allowed bacteria in the centre of the biofilm to survive attacks by chemicals and antibiotics.
Further tests confirmed that the bacteria were communicating electrically. Specifically, signals were passed through biofilms via propagating waves of electrically charged "ions" of potassium.
When the ion channel that permits potassium to flow in and out of cells was removed from the bacteria, communication ceased.
Lead scientist Dr Gurol Suel, from the University of California at San Diego, said: "Just like the neurons in our brain, we found that bacteria use ion channels to communicate with each other through electrical signals.
"In this way, the community of bacteria within biofilms appears to function much like a 'microbial brain'."
The discovery, reported in the journal Nature, alters the way we think not only about bacteria but also about the brain, said Dr Suel.
He added: "All of our senses, behaviour and intelligence emerge from electrical communications among neurons in the brain mediated by ion channels.
"Now we find that bacteria use similar ion channels to communicate and resolve metabolic stress. Our discovery suggests that neurological disorders that are triggered by metabolic stress may have ancient bacterial origins, and could thus provide a new perspective on how to treat such conditions."
The mechanism the bacteria used was surprisingly similar to a process in the human brain known as "cortical spreading depression" which is linked to migraines and epileptic seizures.
"What's interesting is that both migraines and the electrical signalling in bacteria we discovered are triggered by metabolic stress," said Dr Suel. "This suggests that many drugs originally developed for epilepsy and migraines may also be effective in attacking bacterial biofilms, which have become a growing health problem around the world because of their resistance to antibiotics."