Fighting off illness—rather than the illness itself—causes sleep deprivation and affects memory, a new study finds.

University of Leicester biologist Dr Eamonn Mallon says a common perception is that if you are sick, you sleep more. But the study, carried out in flies, finds that sickness-induced insomnia is quite common.

The research has been published in the journal PeerJ.

Mallon says in a release: “Think about when you are sick. Your sleep is disturbed and you’re generally not feeling at your sharpest. Previously, work has been carried out showing that being infected leads to exactly these behaviours in fruit flies. In this paper we show that it can be the immune system itself that can cause these problems. By turning on the immune system in flies artificially (with no infection present), we reduced how long they slept and how well they performed in a memory test.