With the exception of nocturnal and very deep water cephalopods, all coeloids which dwell in light conditions have an ink sac, which can be used to expel a cloud of dark ink to confuse predators. This sac is a muscular bag which originated as an extension of the hind gut; it is a modified hypobranchial gland. It lies beneath the gut and opens into the anus, into which its contents – almost pure melanin – can be squirted; its proximity to the base of the funnel means that the ink can be distributed by ejected water as the cephalopod uses its jet propulsion. The ejected cloud of melanin is bound by mucus particles, so it forms a lump approximately the size and shape of the cephalopod, fixing the predator's attention while the mollusc itself makes a hasty escape.
A general level of provocation is necessary to trigger an octopus to release its ink, as it is biologically costly to produce. Some species can even use their ink to stun or numb their predators.