You might think that only warm-blooded creatures like ourselves can get a raging fever, but in fact cold-blooded beasts like fish can induce fever in themselves

At this moment, all across Europe and North America, zebrafish are cruising over colourful aquarium gravel and darting in and out of sparkling pink castles and plastic plants.

These small, stripey fish are considered cheap and easy pets. You just need to drop in a couple of pinches of flaky fish food and clean the tank once in a while. With fresh water and bountiful food, it looks like a good life – until they get sick.

A poorly zebrafish actually has a big problem if it is stuck in a bowl of water that is maintained at the same temperature day in and day out. By keeping fish tanks at constant temperatures, well-meaning fish owners may be denying zebrafish and other pet fish the chance to survive when they get an infection.

The reason is simple: the fish cannot get a fever to help fight the infection.

Wait a moment, you might say. How does a cold-blooded animal like a fish get a fever?

After all, fish are "ectotherms", meaning they have little or no ability to generate heat internally. Many of us are told that fish, along with amphibians, reptiles and insects, cannot exercise much control over their bodies' internal temperature. Instead, they are at the mercy of the external environment.

There is a lot of truth in this idea, but it is a simplification. Yes, ectotherms cannot generate a fever from within, as we do. However, if an ectotherm like a zebrafish gets an infection, it may well move to a warmer place in an effort to elevate its temperature outside the normal range.

This phenomenon is known as "behavioural fever" and it was first identified in the 1970s.  In early experiments, animals like desert iguanas, bluegill fish, and American bullfrog tadpoles all showed either a preference for warmer temperatures after being infected with bacteria, or increased survival when placed in warmer temperatures.

But it was not clear how this worked. Scientists variously suggested that behavioural fever might overheat the invading pathogens, optimise the host's immune system, or both.

In the past two decades, scientists have become increasingly interested in understanding the mechanisms that underpin behavioural fever. That is partly because they want to understand how Earth's warming climate will affect ectotherm species, and partly out of a growing social consciousness about how we treat captive animals like fish.

Many scientists also want to understand how to control disease and parasites in the aquaculture industry and pet trade. One need look no further than the success of Gyrodactylusparasites to understand why.

These tenacious attackers thrust small grappling hooks into the flesh of their fish victims. The hooks gouge relatively big holes in the skin, creating a host of health problems, says Joanne Cable of Cardiff University in the UK. As the holes multiply, the fish produces more and more mucus, and the rays of its fins begin to fuse together. Eventually, the fish cannot swim and dies.

Cable and her colleagues have called the Gyrodactylus parasites the Russian-Doll Killers, because each female is born pregnant with another female embryo nested inside her. That female will be born within 24 hours, and 24 hours after that, they will both have another. "That means that you only need one parasite to be transferred to a new stock of fish, and the numbers just take off," says Cable.

"It can literally be that one fish will flick their fin against the other, and that is enough for a parasite to jump over," she says. If left untreated, 80-90% of infected fish purchased from a pet shop will die. "It's a big problem."

Gyrodactylus are not just an issue for the pet trade.

In Norway, G. salaris is a significant cause of death for wild salmon. Back in 2008, officials went as far as poisoning stretches of rivers with rotenone in an effort to get rid of the parasites. Cable says Norway puts a high priority on maintaining healthy fish stocks, because fishing is so crucial to the country's economy.

Cable is also trying to find better control measure for parasites like Gyrodactylus. In a study published in 2016, she and her colleagues studied how guppies use behavioural fever to fight off G. turnbulli.

The team gave guppies a choice of three aquarium tanks, which were kept at 18, 24, and 32C. Infected fish spent more time in the warmest tank, compared to uninfected fish. When the parasites were exposed to the warmest temperature for three days, they completely died out.

It had previously been shown that putting infected fish in warmer water improved their response to infection. However, Cable did not expect that the fish would so clearly choose the warmer temperatures on their own.

"It could be a direct effect of the higher temperature killing off the parasites, with nothing to do with an immune response," says Cable. However, she thinks it is more likely that the move to warmer water somehow makes the immune system more effective – or that both factors are in operation. She says the next logical step is to measure whether host immunity is linked to the behaviour.

In a bid to understand the molecular mechanisms underpinning behavioural fever, Simon MacKenzie of the University of Stirling and his colleagues have studied zebrafish. In a 2013 study, they showed that the immune response associated with behavioural fever is highly orchestrated: it is not simply that the immune system speeds up in warmer temperatures.

Once a zebrafish detected an infection, its immune system sent a signal to the brain telling the fish to seek out warmer temperatures. The higher temperature then "allowed the organism to focus its immune response at the molecular level," says MacKenzie. The zebrafish that displayed behavioural fever rapidly cleared their infections.

"It's the very clear focalisation of the immune response, and the way it is coupled with temperature, that is quite surprising," says MacKenzie. "This had not been previously observed."

Behavioural fever is so important, MacKenzie says, some pathogens are making a huge evolutionary effort to undermine it.

Koi herpesvirus, also known as cyprinid herpesvirus 3, attacks fish in the carp family, including domesticated koi carp. It causes lethargy, erratic behaviour, loss of mucus, sunken eyes and, ultimately, death.

The virus carries a gene that specifically inhibits behavioural fever in its host, preventing it from moving to warmer water. This gene is part of an evolutionary arms race between ectotherms and the parasites that invade them.

There is another twist. While behavioural fever usually benefits the host, it can sometimes also benefit the attacker.

Cable highlights a 2011 study showing that, when three-spined sticklebacks are infected with tapeworms, warmer temperatures also benefit the parasite. However, she cautions that "this parasite is known to manipulate the behaviour of its host, so there's a whole range of other factors that are coming into play with that particular system."

As scientists unravel the complexities of behavioural fever, MacKenzie says their research is raising some big questions.

For starters, many captive fish cannot opt for behavioural fever to help fight infections. Is that an animal welfare issue?

"It stops them from expressing what would be a normal behaviour," says MacKenzie. He wonders at what point such treatment impinges on the fishes' Five Freedoms; a set of basic animal rights laid out by animal welfare groups like the World Organization for Animal Health, which include freedom from pain, injury and disease.

There is also the question of how animals with these temperature-coupled adaptations will cope with changing habitats and climate change.

A 2013 study of tree frogs in northern Queensland, Australia showed that they were less likely to be infected by the lethal fungus Batrachochytrium dendrobatidis if they spent more time with body temperatures above 25C – which they achieved by moving around. This seems to imply that, as the global climate warms, this particular fungus will become less infectious – but that is far from certain.

Finally, can the study of behavioural fever in ectotherms tell us anything about fever in ourselves? Strangely, the two phenomena do not look much alike.

"In mammals, it's not too clear fever has a value in terms of infectious outcomes," says MacKenzie. When most people get a fever, they take antipyretic drugs like ibuprofen to bring the fever down – and still recover from the infection. So while ectotherms get clear benefits from behavioural fever, mammalian fever may not be directly related to immune response.

Still, there must be a reason for the existence of fever in mammals. "Fever has to have a functional reason, or it's linked to other evolutionary processes that we can't get rid of," says MacKenzie. "Otherwise, we wouldn't have it."

Regardless of whether or not behavioural fever helps us learn something about mammalian fever, understanding it offers several benefits. It could help us conserve ectotherms in the wild, even as their world changes around them. It could also help us improve the lives of those in our care.

By understanding these animals better, we can promote their wellbeing, says MacKenzie. "That's really what we aim toward."

Never miss a moment. Sign-up now for the BBC Earth newsletter.