Parrotfish make sleeping cocoons to “tuck themselves in” and remain protected from parasites, scientists say.
The fish make the cocoons from a mucus secreted from glands near their gills.
This behaviour has long been a source of fascination for divers and this is the first study to examine its function.
The scientists published their findings in the Royal Society journal Biology Letters.
Dr Alexandra Grutter from the University of Queensland in Australia led the research.
“The bullethead parrotfish (Chlorurus sordidus) takes about 45 to 60 minutes to produce its cocoon,” explained Dr Gutter.
The mucus-producing glands behind their gills are about the size of a 10 pence piece; large organs for a fish that grows to a maximum length of 40cm.
To find out if the sleeping cocoons had a protective role, the researchers conducted an overnight experiment.
They exposed coral reef parrotfish with and without cocoons to skin parasites called gnathiids.
Fish without mucus cocoons were attacked more by gnathiids than fish with cocoons.
Dr Grutter told BBC News: “What I find most exciting about these results is the unique way these fish deter parasites at night while still being able to sleep, an approach not used to my knowledge by any other animal.
“The amount of effort that goes into building these cocoons, which requires fish to have developed very large glands, is extraordinary.”