Australian scientists say they have cracked the code that explains why reptiles change sex under the stress of extreme temperatures.
The proposed model could also help manage biodiversity as reptiles come under pressure from climate change.
"The Australian dragon lizard has sex chromosomes similar to birds that determine sex at normal temperatures. But at high temperatures, embryos with male sex chromosomes reverse sex and hatch as females," said study author, CSIRO evolutionary geneticist Clare Holleley.
Scientists are concerned that rising temperatures could affect the sex ratio of species like the bearded dragon.
Dr Holleley said that for these species "survival under climate change comes down to: move, adapt or die".
It's been known for some time that temperature extremes can trigger sex reversal in reptiles.
In bearded dragons sex reversal starts to occur at low percentages in male eggs when they are incubated at 32 degrees.
"At 36 degrees we see sex-reversal in about 100 per cent of the male offspring," Dr Holleley said.
The bearded dragon distribution extends into the desert regions of Australia, so 36-degree soil temperature is entirely feasible.
"The dragons usually bury their eggs in the soil about 10 centimetres below ground: it would be a bit like a kiln," she said.
Breeding occurs between September and February, "so through the summer months is when it's all happening", she said.
In turtles, there are concerns that rising sea temperatures could nudge populations towards becoming all female, if species are not able to adapt.
Sex reversal in alligators has been recorded when incubating eggs are too hot or too cold, but scientists have not know what causes these changes.
Australian scientists at the Garvan Institute in Sydney, University of Canberra and at the CSIRO have now described a specific molecular and genetic pathway that causes what is known as "temperature-dependent sex determination".
The study, published on Thursday in the journal Science Advances, provides a genetic model that could explain all such sex reversals in reptiles.
Professor Rick Shine from the University of Sydney, unconnected to the study, said: "This elegant research ... [shows] the same mechanism is found across a wide range of reptile types.
"The authors' results may one day enable us to manipulate sex ratios of endangered species to assist in conservation."
In the normal transcription of RNA - ribonucleic acid, essential for the development of proteins - strands of "junk" genetic code called "introns" are spliced out as the RNA matures.
Garvan Institute researcher Ira Deveson was comparing the genetic sequence of male bearded dragons with females and sex-reversed females.
He was astonished to find that in sex-reversed females, two specific intron sequences - part of a family of modifier genes called Jumonji - were retained.
"We aren't sure what introns like the Jumonji genes are for: it seems they help switch genes on and off at the right time," Mr Deveson said.
Temperature-induced stress in the dragons means the retention of the Jumonji genes "override chromosomal sex-determining cues, triggering sex reversal", the study says.
Using data from other studies, the researchers found the same process in alligators and turtles.
Associate Professor Craig Smith did his PhD 25 years ago looking at temperature-dependent sex determination. He is now a developmental biologist at Monash University and was not connected to this study.
"In those 25 years there has been significant advances in this field," he said. "This is an intriguing study and it forms a strong basis for future research,"
"You would think with climate change reptiles would become extinct as temperature would skew sex ratios," he said.
"However, this is probably not the case. Alligators and turtles have been around for millions of years and have adapted to big changes in climate."
Previous research by Dr Holleley suggests that temperature-dependent sex-determination could allow reptiles the capacity to compensate for climate change, depending on how how quickly their thermal sensitivities adapt.
Associate Professor Smith said the proof of the pudding for this model will be seeing if they can directly manipulate the Jumonji genes in the lab to determine sex outcomes.
Gene manipulation in mammals is done using the relatively new CRISPR splicing technology. Mr Deveson said to prove their model convincingly will require development of similar techniques for reptiles.
He hopes that their team will be able to carry out two experiments to prove their model.
The first will be to remove the Jumonji gene sequences in eggs at high temperature to see if this halts sex reversal. The other will be to see if they can maintain Jumonji genes at normal temperatures to induce sex reversal.