Ernest Hemingway prized sleep for good reason. Not one to dwell on rest and recuperation, the novelist saw snoozing as a form of damage limitation. “I love sleep,” he once said. “My life has the tendency to fall apart when I’m awake.”

The author’s observation may be truer than he imagined. Scientists have discovered that broken DNA builds up in brain cells in the daytime and repair work reverses the damage only during sleep.

“I think this is one of the key reasons we need to sleep,” said Lior Appelbaum from Bar-Ilan University in Israel. “An offline period gives us time to clean up everything for the next day, to give us a fresh start before we are busy with wakefulness again.”

For an act so universal, sleep has enormous benefits. Found in organisms from flies to worms and jellyfish, it restores the body and helps learning and memory. But despite extensive research, the purpose of sleep is still mysterious.

Appelbaum and his student, David Zada, reasoned that if sleep had evolved in all organisms with a nervous system, then it might be working at the level of individual neurons.

To find out, they genetically engineered small, transparent zebrafish so the chromosomes in their neurons carried colourful chemical tags. The researchers then used a powerful, specialised microscope to watch how the chromosomes moved in the neurons, and how often DNA was broken, when the fish were awake and asleep.

When the fish were awake, the chromosomes did not move much and broken strands of DNA built up in the neurons, as part of the normal wear and tear of life. If the fish were sleep-deprived, by tapping on their tank for example, some of the neurons accumulated so much genetic damage they were in danger of dying off.

But, when the fish fell asleep, the picture changed. The scientists noticed that the chromosomes changed shape far more often in sleeping fish, and that DNA damage in their neurons plummeted. The same happened when the researchers added a sleep-inducing drug to the tank, causing the fish to fall asleep in the daytime.

Appelbaum said that chromosomes are constantly changing shape to allow the cells’ natural repair mechanisms to mend DNA damage at different points. When awake, the repair work cannot keep up with the rate at which damage builds up, but in the calm hours of sleep, the repair mechanisms have a chance to get on top of the job.

“It’s surprising, because the brain goes into a rest state, but the chromosomes move about twice as much during sleep,” Appelbaum said. “There is repair going on in the day, but sleep allows you to catch up.”

The process is akin to local councils patching up potholes at night when the traffic has eased.

“I propose that, when we are very tired, neurons accumulate so much damage that they signal the whole brain that we have to go to sleep to fix the damage and avoid going into an unsafe zone,” he added. The study is published in Nature Communications.

Having spotted the effect in zebrafish, the researchers want to study mice to see if chromosome movement and DNA repair matches brain activity linked to different phases of sleep in mammals.

The work follows a January study by Siu-Wai Choi at Hong Kong University who used blood samples to show that sleep deprivation led to more DNA damage in doctors. She said Appelbaum’s work revealed how DNA breakages accumulate in waking hours and decrease during sleep, only to build up again the next day.

“It is clear from this study that chromosome dynamics during sleep has an essential role to play in repairing damaged DNA,” she said. “Though these results were obtained in an animal model, together with other studies conducted in humans, it does give us food for thought with regard to our lifestyle choices, shift working patterns and long-term health.”