Fungi come in all shapes and sizes. While most fungi live off decaying matter in the soil, others form symbiotic relationships with various plants, insects, and algae, providing a source of food and nutrients in exchange for a habitat and protection. In some cases, those relationships are rather one-sided.
The genus Cordyceps is made up entirely of endoparasitoids--parasites that develop inside of their host. These invade an insect, replacing its tissue and organs with their mycelia (a mass of thread-like hyphae that absorb nutrients from the environment) and stroma (a stalk-like fruiting body).
Cordyceps unilateralis, the species shown here, is able to control its ant host from within, forcing it to climb up a plant and settle near the top, whereupon the ant dies. By then, the spores attached to the fungus' fruiting body, which has emerged from the ant's head, have almost fully matured. When the time is right, they rain down on more unsuspecting ants, restarting the cycle.