Vampire bats are probably not the cuddliest of critters, considering nearly their entire food source consists of blood.

But how these furry little mammals ended up guzzling blood has puzzled researchers, and a new analysis shows their very distinct gut bacteria might be a big part of the story.

There are three types of bats who solely drink blood, the common vampire bat (Desmodus rotundus), the hairy-legged vampire bat (Diphylla ecaudata), and the white-winged vampire bat (Diaemus youngi).

All three of these animals evolved from bats who eat fruit, but we still aren't sure how they managed to make the huge leap to the minimally nutritious, and relatively dangerous activity of drinking blood.

This is because subsisting on just blood, called hematophagy, is very uncommon. The amount of liquid can overwhelm the kidneys, too much can cause iron poisoning, and excessive protein isn't good for the body either.

And blood is super high in protein (93 percent), but extremely low in carbohydrates (1 percent) and vitamins. Plus there are a bunch of blood-borne diseases.

The international group of researchers took samples of the bats' droppings to look at something called the 'hologenome' – the entire set of genes of an organism, including all the bacteria and other microbes that make that creature their home.

They analysed the common vampire bat's hologenome against a number of insect-, fruit-, or meat-eating bats to try and determine what makes the vampire bat so weird.

What they found is that the gut microbes in the bat were an especially unique combination, which most other bats (or other mammals) wouldn't be able to stomach.

In fact, more than 280 of the bacterial species found in the droppings are known to cause disease in other mammals.

"The data suggests that there is a close evolutionary relationship between the gut microbiome and the genome of the vampire bat for adaptation to sanguivory (feeding exclusively on blood)," biologist Marie Zepeda Mendoza of the University of Copenhagen in Denmark told the BBC.

The researchers also found that the vampire bat's genome had more transposons, also known as 'jumping genes' - genes in the DNA that are able to multiply and move around the genome.

There was as much as a 2.2 fold increase in the amount of one particular transposon, called MULE-MuDR in the vampire bat, compared to other types of bats the researchers looked at.

The extra MULE-MuDR copies were mostly found in areas involved in immune response, viral defence and metabolism. The researchers think this helps the bat better process the huge amount of blood it can ingest per day, without getting sick.

"It is clear from our results that the common vampire bat has adapted to sanguivory through a close relationship between its genome and gut microbiome," the researchers write in the paper.

Well, that explains one of the mysteries of the vampire bats, and you could argue that jumping genes and dangerous gut bacteria make them even more interesting creatures now than before.

But as Mendoza jokes to BBC, "I usually call them 'messed-up creatures'."

The research has been published in  Nature Ecology & Evolution.