But gender depends on more than anatomy or hormones. William Reiner of the Oklahoma University Health Science Center told a meeting of the American Association for the Advancement of Science.

Think twice before surgery One of the more common is congenital adrenal hyperplasia.

In such cases, genetic girls with XX chromosomes are exposed in the womb to such high levels of androgen — the hormone that triggers male development — that they appear male externally even if they have female reproductive organs.

A different condition leaves genetic males less responsive to androgen during development, so they’re born without a penis.

The parents must pick a gender somehow, to know what to call their child and because gender is required on a birth certificate.

Doctors also once thought that how people were raised and their genitalia were enough to determine gender, said Reiner, who as a urologist performed sex-assignment surgeries on babies.

But Reiner began seeing children who had been assigned to one sex as babies and a few years later began identifying themselves as the other.

He re-trained as a psychiatrist to study these children.

So specialists check non-obvious factors such as which sex chromosomes the child has and levels of sex hormones in the blood.

But Vilain’s research suggests there are factors at work that can’t be measured.