The product of secondary metabolism plays a vital role in interactions between plants and other organisms.
They also play an ecological role in governing interactions between plants and other organisms.
The product of secondary metabolism also helps in attracting pollinators, fruit and seed dispersers. These are because of their bright coloured pigments of flowers.
Few toxic compounds, which are produced from secondary metabolism like nicotine, which helps the plant in protecting them from plant eating animals (herbivores) and also from the microbes.