Everyone has done things they're not proud of when they can't find a suitable mate, but the flatworm takes it to another level.

New research from the University of Basel and Bielefeld shows just how far the Macrostomum hystrix – a species of flatworm – will go to reproduce. The findings, published into the Proceedings of the Royal Society B, show that it is willing to inject sperm into its own head.

This species of flatworm is a simultaneous hermaphrodite – meaning that it has both sets of gender and can fertilize itself.

The Macrostomum hystrix is virtually transparent which makes it easier to see its insides under the microscope while it is still alive. Researchers found that, if the worm is kept isolated, it had very few sperm in its tail region – where worms store their sperm – and more in its head region.

It means that by using its "needle-like" penis, it injected sperm into the front of its body, where it can travel towards the eggs.

Dr Steven Ramm, first-author of the study, said: "As far as we know, this is the first described example of hypodermic self-injection of sperm into the head. To us this sounds traumatic, but to these flatworms it may be their best bet if they cannot find a mate but still want to reproduce." Although this does technically mean that its offspring will be inbred.

The research paper adds that the complicated route from head to eggs is needed because there are no internal connections between the worm's male and female reproductive systems.