This matter and energy comes from detritus from fallen leaves and branches, and forms the base of important marine food chains.
Bacteria break down the detritus, releasing useful nutrients into the water that can then be used by marine animals. These same bacteria give mangroves their "rotten egg" smell - as the sediment is oxygen-poor, only bacteria that use sulphur for energy can survive.
The dense root systems form a home for fish, crabs, shrimps, and molluscs. They also serve as nurseries for juvenile fish. Many coral reef fish, for example, spawn in mangrove forests. The young fish stay in the forest, where there is plenty of food and they can shelter from predators, until they are old enough to move to the reef.
In addition, mangrove forests are nesting and migratory sites for hundreds of bird species, as well as home to a wide variety of reptile, amphibian, and mammal species. For example, the Sunderban mangroves of India and Bangladesh - the largest mangrove forest on Earth - are home to Bengal tigers, spotted deer, saltwater crocodiles, fishing cats, and various dolphin species.