Bacteria plays important role in an ecosystem because
they act as decomposers.
Microorganisms like bacteria and fungi, act as decomposers as they break down complex organic substances into simpler inorganic substances that go into the soil. These inorganic substances are then recycled by plants.
Decomposers are considered to be of great importance as in their absence, earth would be filled with dead bodies.