Is it a boy or is it a girl? It's the question parents ask in the first moments of a new life, right after they seek reassurance that their baby is healthy. Questions don't come much more basic but the answer is more complex than you might think.

For centuries, it seemed simple. Men had male genitals; women female ones. This didn't do for those who fell between but science seemed to lend a hand when in about 1905 it came up with a way of telling the sexes apart that went beyond appearances, in fact into our cells. Men had XY chromosomes; women had XX.

That's about where the thinking stayed until in 1990 researchers studying people once labelled hermaphrodite - but today more accurately described as intersex or as having disorders of sexual development - made a significant discovery.

They found that a hitherto unknown gene, SRY, was needed to start the process of "maleness". What the discovery of Sex-determining Region, Y-chromosome - to give it its full name - did was reopen the gender puzzle. Assuming that chromosomes determine sex was no longer enough. Much more was going on.

The holy grail is finding an indisputable dividing line between male and female. It probably doesn't exist. It is not the body, as inter-sex children make clear.

One in 2000 babies are born with mixed sexual anatomy - often external genitalia that are ambiguous such as a phallus that looks somewhere between a penis and a clitoris, or a divided scrotum that looks more like labia.

Then there are those whose chromosomes don't match the usual XX or XY pattern.

Research by American intersex expert Dr Milton Diamond suggests that those who have some biological variance from the standard male or female may be as high as one in 100.

Most have normal looking sex organs and only discover they are different when they try to have children. Or, in the case of South African runner Caster Semenya, when they win a world women's championship and because of their masculine appearance, are required to undergo a sex test.

Are they male or female? The biology does not always make it clear.

The way doctors respond to such cases has changed from the 1960s when often the practise was surgical intervention - as advocated by New Zealand psychologist and sexologist, the late Dr John Money.

The US-based Money believed that nurture was more powerful than nature and that if you look like a girl and are raised as a girl then you will be a girl.

His view, which prevailed on the east coast of the US, was patriarchal, in that the concept of a female revolved around fertility while for males the issue was the penis. If a child had a very small penis that wasn't thought to be functional and looked abnormal, gender would be reassigned to a girl and phallus and testes removed.