It sounds like something out of a horror movie, but it happens more often than you might think in the insect world: viruses taking over their hosts and driving them towards death so that the virus might more easily spread to other victims.

This has actually been going on for hundreds of millions of years scientists think, and new research sheds some light on how exactly it happens. Specifically, how it happens with a group of insect-infecting viruses known as nucleopolyhedroviruses (NPVs) and cotton bollworm (Helicoverpa armigera) caterpillars.

As has been observed for more than a century, NPVs are known to drive their caterpillar hosts to the top of plants before dying, whereas the more natural behavior is for the caterpillars to sink to the earth before pupating.

Now we have a better idea of the underlying mechanism behind this 'tree-top disease' as it's known, and it's all to do with phototaxis, or the way that organisms are drawn towards a light source (like the Sun).

In a new study, researchers from China Agricultural University ran a series of experiments with the cotton bollworm caterpillar and an NPV called HearNPV.

"The mechanisms by which parasites and pathogens manipulate host behavior are of broad interest, but few studies have definitively characterized them," write the researchers in their paper.

"Here, we illustrate how HearNPV induces enhanced phototaxis in H. armigera larvae by hijacking the host's visual perception and triggering climbing behavior, causing infected larvae to die at an elevated height."

Previous research had suggested that caterpillars infected with HearNPV were drawn towards light sources, and here it was confirmed using LED lights, glass tubes, and climbing mesh. The insects with the virus would end up dead at the top of the mesh, and the higher the light, the higher they climbed.

Further tests with lights in different positions confirmed that it was the illumination that the caterpillars were attracted to, rather than any response to gravity or higher elevations, and that their vision was being used against them: blind H. armigera were not affected by HearNPV to the same extent.

How all this climbing helps the virus isn't fully clear. But if caterpillars are dying up at the top of plants, it presumably gives the host virus more opportunity to spread further, whether that's being carried on the wind or chewed up by a predator.

"Since sunlight shines on plants from above, positive phototaxis is probably a reliable mechanism to ensure that infected larvae die at high elevations on host plants," write the researchers.

Having confirmed the earlier hypothesis, the researchers then looked at genetic differences between infected and non-infected caterpillars. They found six genes involved in the response to light that were expressed differently when the HearNPV virus had taken hold, and ultimately identified three that appear to be the most relevant.

Those three were HaBL (for detecting short-wave light), HaLW (for detecting long-wave light), and TRPL (which converts light into electrical signals). When these genes were cut off in infected caterpillars, the insects were less likely to be attracted to the local light source or to end up dying close to it.

All of which means these nucleopolyhedroviruses appear to hijack the insects' natural affinity for light and use it against them. The next question for scientists is exactly how these genes are manipulated by the virus – but that's a story for another study.

The research has been published in Molecular Ecology.