The worms can produce both sperm and eggs
With a surprisingly simple genetic tweak, scientists have transformed nematode worms into hermaphrodites.
They report in the journal Science that lowering the activity of just two genetic pathways produces the change.
Evolution from a species consisting of males and females into one consisting of only males and hermaphrodites happens naturally in many nematodes.
A team of US researchers says their experiment explains how this might take place.
They say it also provides a simple model helping scientists to work out the mechanism of evolutionary change.
The researchers chose to study the evolution of female worms into hermaphrodites because it was a "striking change" that occurred relatively recently.
Ronald Ellis, a biologist from the University of Medicine and Dentistry New Jersey in the US, who led the research, said that most big evolutionary changes within species happened too long ago to study at the genetic level.
"But this dramatic change happened fairly recently and in a group of animals that we know a lot about... that's why we're studying it to find out how complex traits are created," he told BBC News.
Dr Ellis said it was exciting to discover that, by lowering the activity of just two genetic pathways he and his team were able to "take what should have been a female animal and turn it into a cell fertile hermaphrodite".
The two genes the researchers "tweaked" were one involved in making sperm and another involved in activating them.
"These were small changes to the activity of genetic pathways that already existed," said Dr Ellis.
"So the pieces were already in place, they just had to be altered so they worked in a slightly new way."
He said the finding was surprising because it was such a simple change that produced a trait that was so dramatic.
Genes of change
The scientists use nematode worms as simple models to show how evolution works at a genetic level.
We understand how evolution tweaks simple traits, like a giraffe's neck [getting] longer and longer over time," he said.
"But most of the most important changes - the creation of the eye, the development of feathers in birds, wings in insects - involved the creation of novel traits.
"The better we understand this, the better we can understand the kinds of changes that created humans from our ancestors."
Dr David Lunt, an evolutionary biologist from the University of Hull, UK, who was not involved in this study told BBC News that said this was an "excellent experiment".
"Scientists study the evolution of sexual systems because it allows us to see all the forces of evolution at once," he explained.
"We have very few model systems anywhere near as powerful as this one."