A tiny group of cave insects in Brazil gave scientists a big surprise when they discovered that females in the group have penises and males are equipped with a vagina.

This is the first time such a sex organ role reversal has ever been documented, and researchers had to invent the term "gynosome" for the female insect's penis. The males, in contrast, possess a vaginalike structure called a phallosome.

The genus of insects called Neotrogla was first documented nearly 20 years ago in a Brazilian cave by biologist Rodrigo Ferreira at the Federal University of Lavras in Brazil.

While exploring the cave, Japanese entomologist Kazunori Yoshizawa of Hokkaido University found a new type of Neotrogla that happened to be in the act of mating. In the name of science, Yoshizawa pulled the two insects apart while they were engaged in intercourse, finding that the penis organ was so firmly embedded in its partner that it ripped open its partner's abdomen rather than dislodge.

It was upon inspecting the mishap that Yoshizawa realized that the penis belonged to the female in the mating pair.

"The female penis is a completely novel structure," said Yoshizawa told The Verge.

Gender in the animal world is not defined by sex organ or sex chromosomes, but by the size of the animal's gametes - seen as sperm in males and oocytes in females. The rules of biology state that females have larger gametes than males. And this remains the case with these insects; the females produce the largest gametes. The females also happen to have a penis, which they use, perhaps forcefully, to fertilize their eggs with smaller gametes from the male species' phallosome.

During mating the female mounts the male and pries open its vagina-like opening using her inflatable, spiky gynosome, which, as Yoshizawa learned, gets inserted so forcefully that it can rip the male apart if not dislodged properly.

What's more, the mating act of these insects lasts anywhere from 40 to 70 hours.

During this prolonged copulation "a large and potentially nutritious ejaculate is transferred from the male via the gynosome," the researchers report in the journal Current Biology. "The correlated genital evolution in Neotrogla is probably driven by reversed sexual selection with females competing for seminal gifts."

"Because the female's anchoring force is very strong, a male's resistance may cause damage to his genitalia," Yoshizawa told The Verge. "Therefore, it is very likely that entire mating processes are controlled actively by females, whereas males are rather passive."

According to Slate, Yoshizawa called the gynosome the "ultimate device for controlling copulation."