Some babies are born with a genetic variant that leads to atypical sexual development. It can result in the child being neither a typical boy nor girl.
Estimates of this occurring range from one in 1500 or 2000 births, to 4 per cent of all births, depending on what definitions are used.
Whether surgery, hormone treatment or both are necessary, or whether they represent child abuse and it's better to do nothing, has stirred considerable debate.
Chromosomes and sex development
Genetic differences between men and women lie in sex chromosomes. Women have two X chromosomes and men have a single X (from their mother) and a male-specific Y (from their father).
In typical male development, a single gene kick-starts a cascade of genes that make a testis. The embryonic testis makes hormones, and hormones make the baby male.
In an XX fetus, other genes become active to make an ovary in an embryo that will become a girl.
Both cascades involve many genes in a network of checks and balances. So far we know of about 30 that must work together to build a normal testis or ovary.
Other genes control development of the genitals and secondary sexual characteristics, such as breasts and body hair. It takes many genes to make a penis from flaps of skin that have to come together in the right way, or to zip up the labial folds to make a scrotum.
And, as in any complex process, sex determination can go awry ...
Atypical sex development
Different sex conditions result from variants in one of several genes.
Some can lead to minor anatomical differences, such as the opening of the penis appearing at an unusual site; others to ambiguous genitals.
For instance, loss or alteration of a gene in the testis-determining pathway prevents testes from forming, and may produce an XY baby with masculinised female genitals (an enlarged clitoris, for instance). Some of these children may become more masculine when hormones rev up at puberty.
Other gene variants can reverse sex altogether, as in cases of androgen insensitivity. A variant in a gene for male hormones will cause an XY baby to develop as a female, even though she has testes.
At the tragic end of the spectrum are mutations that disrupt more than sexual development. Deletion of a gene controlling sex as well as bone formation can cause bone deformities so severe that babies can't breathe and die within hours.
It's impossible to lump this spectrum of conditions into a single category. The term intersex, for instance, describes those with ambiguous genitals, or gonads with both testis and ovarian tissue. But it doesn't apply to others, such as XY girls with androgen insensitivity.
Disorders of sex development (DSD) is the term adopted medically. Not surprisingly, patients shy away from labels like this that denote a disease and invite discrimination.
Is it better to treat?
It's possible to assign babies of uncertain sex to either a boy or girl and use hormone treatment to reinforce the gender choice. Whether this is appropriate has been vigorously debated by patients, doctors and advocacy groups.
For decades, surgeons advocated operating early because it had better medical success and provided a consistent gender identity. This was often successful and many patients reported living satisfying lives.
But it raised problems of informed consent, as parents made the decision on their child's behalf as to which sex they would be. What if they got it wrong and the child grew up hating who they were?
Some people have reported growing up never feeling comfortable or accepted in their gender role. There are many accounts – real life and fictional – of difficult transitions to the other sex, as in the Pulitzer-Prize winning novel Middlesex.
Now, the trend is to be supportive, conservative and avoid removing genital tissues if the condition is not life threatening.
But there are no universal answers. In a perfect world, it wouldn't matter if a child was a boy, girl or a happy intersex. But our society is sexualised and children can be cruel to those even trivially different.
Adults are sometimes no more accepting; in some Asian and African countries families with these children may be ostracised and children neglected or killed.
Developed countries are moving in the right direction in their treatment of DSD people and community attitudes are slowly improving.
Hopefully we can become more accepting of genetic variation, whether it be towards webbed toes or sex determination.
Jenny Graves is a Distinguished Professor of Genetics, La Trobe University.
This article first appeared on The Conversation.