They play an important role in the cycling of nutrients, hence allowing the ecosystem to function through materials and energy flow, e.g., the decomposing materials are known as detritus which are eaten by small animals (earthworms) otherwise known as detritovores.
The activities of decomposers help to break down complex compounds into the simple ones which are then reabsorbed by plants to constitute (build up) complex compounds. They prevent the accumulation of the remains and waste of living organisms on earth. They are also useful in getting rid of sewage material.
Leaf –> Earthworm –> Small bird –> Big bird –> Detritus –> Detritovores