The image above looks like a medieval mace: a tubular structure with nasty-looking spikes. But these are no carefully crafted human weapons.

Instead, they are the penis spines of a bat. For some bats, sex is quite literally a thorny business.

The question is, why do some bats have penile spines? What are they for, and why do their sizes and shapes vary so much? Based on what we know from other species with similarly spiky penises, there are several possibilities.

Perhaps the spines remove the sperm of rival males, or hold a pair of copulating bats together while they mate in mid-air. Or maybe they really are a kind of weapon: conceivably they evolved to damage the female's genitals, preventing her from mating with additional males.

This mystery has been around for a while.

So far she has found penis spines in 12 species

In the early 1990s, James Ryan at Hobart and William Smith Colleges in New York discovered spines on the penis surfaces of four species of free-tailed bats.

Penis spines were also described in the 1980s in south Australian insectivorous bats by William Breed of the University of Adelaide, who found remarkable differences in spine shape and size.

These "beautiful images" intrigued Teri Orr of the University of Massachusetts Amherst. Working with her supervisor Patricia Brennan, she has been taking a closer look.

By obtaining specimens from museums and picking up dead bats wherever she finds them, Orr has examined 38 bat species from 9 families. So far she has found penis spines in 12 species.

There are over 1300 bat species worldwide, far too many to study, so Orr plans to survey perhaps 50 more. The aim is to have samples from each branch of the bat family tree.

She says she has been "blown away by the diversity".

Bat penis spines vary enormously in size, from a teeny 47 microns in the velvety free-tailed bat (Molossus molossus), to a wince-inducing 1cm in the hoary bat (Lasiurus cinereus).

As a general rule, small bats have proportionally smaller penises and therefore proportionally smaller spines.

However, some males have penis spines that are outrageously large compared to their bodies. Hoary bats are about the size of a fat mouse, with a nose-to-tail length of no more than 15cm, so their 1cm long penis spines are seriously large: the largest proportional to the body of any bat studied so far.

Several ideas have been put forward as to why penis spines have evolved, and why some species have such large ones.

One idea is that penis spines allow male and female hoary bats to stay coupled for mating in the air. This is called the "in-flight locking hypothesis".

In tree-roosting bats, which include hoary bats and eastern red bats, it's possible their remarkably long penis spines evolved to facilitate this locking. "They're huge spines, and these are small bats," says Orr.

Like car park spikes, the spines on these bats' penises orient backwards. That means it is easy for the penis to go in, but difficult for it to go out.

There are lots of anecdotal observations of tree-roosting bats fluttering to the ground in coitus, and occasionally fatally crash landing. That suggests the in-flight locking hypothesis has wings.

If you're a bat, joining the mile high club is presumably no small challenge, since you have to flap your own wings to stay aloft. So if these bats do mate like that, they might well benefit from a Velcro-like penis.

The hypothesis is far from proven. But it's an idea that makes sense to Paul Cryan of the United States Geological Survey in Fort Collins, Colorado.

Cryan has spent much of the past decade trying to figure out why certain bats are dying in disproportionate numbers at wind turbines. Migratory tree-roosting bats, including the hoary and eastern red bats, are among the most frequent victims.

They might even be using the wind turbines as launch pads

Accounts dating back to the 1800s describe "seeing two bats grabbing each other in mid-air, and falling to the ground, appearing to be copulating," says Cryan. "All of the stories I was reading that accumulated over time seemed to suggest there was something really strange going on with the behaviours of these bats."

One possibility is that the bats are drawn to tall trees and other such high roosts as gathering places for breeding. If that's true they might also be drawn to wind turbines.

They might even be using the wind turbines as launch pads, with pairs of bats leaping off the top and mating as they fall.

However, in-flight locking can't be the only explanation for bats' spiny penises. Many bats don't mate in mid-air at all.

Indian flying foxes have sex while hanging from a tree branch affair

In the tiny number of bats in which copulation has actually been observed – less than 1% of the world's bat species – sex most commonly occurs on surfaces.

Brock Fenton of the University of Western Ontario in Canada has sometimes caught little brown bats in the act. "The ones I've seen have been in a hibernation site, in a cave, or a mine, or on a ceiling," he says.

The few observations we have suggest that bat sex can be a dizzying business, in more ways than one.

Indian flying foxes have sex while hanging from a tree branch affair. Males often perform cunnilingus on the females, and this seems to prolong the act of copulation.

Oral sex also seems to be important to short-nosed fruit bats. In wild-captured individuals of this species, females often lick their mate's penis shaft during copulation.

Bonin flying foxes studied in Japan have even busier lives. Females hang from trees in clusters, and males defend a cluster of females from other males.

It's hard to see how penis spines would fit into the activities of these surface-mating bats. The spines surely can't be a form of high-flying Velcro. One possibility has to do with the intricate processes that take place after bats have had sex.

Bats have complicated post-coital lives. Females can store sperm, delay fertilisation, and even delay the development of embryos by placing them in a kind of suspended animation.

A female storing sperm can keep it in her reproductive tract for up to 300 days before using it.

That is great for her, but not great for a male who subsequently mates with her. He has no guarantee that his sperm will be the ones that fertilise her eggs.

So sperm storage suggests an alternative explanation for penis spines. Maybe they are tools for sperm removal. Males could be using them like bottle-brushes to scrub out the stored sperm of their rivals.

In line with that, Orr has found that species that delay fertilisation more likely to have penis spines. That makes sense, as females of those species are more likely to be carrying around sperm from multiple males.

Orr also expected penis spines to be more common in bat species with larger testes.

Males evolve big balls if females often mate with multiple males. In this situation, the males face stiff competition for the privilege of fathering offspring, so they need to produce lots of sperm to improve their chances.

Some male bats have remarkably big balls. In some species, the testes make up 8.4% of their total body mass. That is the equivalent of a 200-pound man with a 17-pound pair of testicles.

"These are two different solutions to the same problem," says Orr.

A male bat faced with lots of rivals could make more sperm by growing bigger balls, or remove the sperm of his competitors by growing spines on his penis. "Maybe if you have enough pressure you might do both."

However, Orr hasn't found a positive link between big bat balls and the presence of spines. It may be that the competition among males isn't intense enough to force both responses.

So far the evidence for the purpose of penis spines is all a bit inconclusive. To really find out what the spines are doing, we need to find out what they do to the females.

For now we don't know too much about that, but there are plenty of other creatures with spiny penises that offer clues.

Female bedbugs have evolved "crazy layers of tissue" in the most frequently stabbed areas

One such species is the bed bug. Males have penises like hypodermic needles, which they stab into females' bodies "nowhere near where you might expect them to aim," says Orr. This might be a way to force their sperm onto reluctant females.

Male bats don't stab females like bed bugs do, but there might be something similar going on.

In response to the males' behaviour, female bedbugs have evolved "crazy layers of tissue" in the most frequently stabbed areas, says Orr. Female bats might have adapted to penis spines in a similar way.

Orr is now using micro-CT scans to see what is going on inside the females.

It may be that the females are toughened up in the areas hit by the spines, just like female bed bugs. That would suggest that the spines are there to damage the female's genitals, and that the females are fighting back.

Bats are the only mammals that can fly

Her studies should reveal whether the spines can reach the sperm storage "pockets" inside the female's reproductive tract. If they can, it would support the idea that the spines act like bottlebrushes, removing the sperm left behind by other males that previously mated with the female.

So far there isn't a definitive answer to the question of why male bats have spines on their penises. Their function remains "a bit of a mystery," says Orr.

It may be that there isn't a single answer: the spines might have evolved for different reasons in different species. Bats are the only mammals that can fly, so evolution may have had plenty of room to get creative with their love lives.

Lesley Evans Ogden is @ljevanso on Twitter