Bacteria are responsible for the decomposition process at the end of food chains and food webs. In this process, they also release useful gases and nutrients for other living organism. Bacteria that live within the digestive tracts of ruminants and some insects digest cellulose for these animals. Some bacteria also participate in the nitrogen cycle, carrying out the fixation of nitrogen, nitrification and denitrification, almost always in a mutualistic ecological interaction with plants. Bacteria present within living organisms, such as those that live inside the bowels, compete with other pathogenic bacteria, therefore helping to control the population of noxious agents. There are also bacteria that cause diseases and bacteria used in the production of medical drugs.
The excessive Growth or mass destruction of bacteria can impact entire ecosystems. For example, when a river is polluted by organic material, the population of aerobic bacteria increases since the organic material is food for them. This large number of bacteria then exhausts the oxygen dissolved in the water and other aerobic organisms (like fish) experience mass death.