Image caption 800m World Champion Caster Semenya was forced to undergo gender testing to prove she was a woman

A child that is born neither male or female is a rare occurrence but babies born with some form of Disorder of Sex Development (DSD) happens in one in every 1,500 births, according to the support group Accord Alliance.

For some born with a DSD it can mean growing up in a world of shame and secrecy, but many people are working to foster openness about it.

After Janet was born, it was difficult to tell if she was a boy or a girl. "When my grandfather learned there was a question of my sex, it was suggested by him that they just let me die," she says.

Now in her 50s and a mother of two, she was born with a womb, ovaries and female genes but her genitals and hormones were partly masculine. She was diagnosed with congenital adrenal hyperplasia, a DSD where her body makes too much testosterone.

Find out more Me, My Sex and I is on BBC One at 22:35 on Tuesday 11 October Me, My Sex and I

Male and female genitals grow from the same tissue, but testosterone makes them look and develop differently. So an enlarged clitoris can be something between male and female.

Living with this condition, says Janet, left her a "psychological mess" for many years.

A wide range of factors determine a baby's sex. Disruption in the development of any of these can cause a disorder of sex development. They can range from girls with more masculine characteristics and vice versa, to babies born with indeterminate sex, previously known as intersex.

Clinical psychologist and sex therapist Dr Tiger Devore was born with indeterminate sex. He has severe hypospadias, an abnormality of the penis, which in its milder form can affect one in 250 men.

"(Intersex) people are usually raised with shame and secrecy," he says.

Image caption Dr Tiger Devore says parents of intersex babies feel "fear and guilt they gave birth to a child like this"

"Those babies are hidden from general society - and that was my experience of growing up."

"I always had to keep it a big secret. I could not tell anybody I was having surgery down there, which we're not supposed to talk about."

Aileen Schast, a clinical psychologist who counsels families at the Children's Hospital of Philadelphia, says: "It can be very confusing and isolating for families and what worries me the most is an early feeling of shame starts to develop, as this has to do with genitalia, and we don't talk about that.

"Everyone is dying to find out what the baby is and how do you say we don't really know yet.

"I had one parent tell me she almost wished her child had cancer because at least people have heard of it, so when she needed support she could say this is what my child has and people would know what it meant."

Choosing a sex

Since Janet and Dr Devore were born there is much more understanding about Disorders of Sex Development.

Today the whole family of children born with a DSD are involved from the beginning, and urology, endocrinology, genetics, social work and psychology experts also work together.

How do you determine sex? To determine the sex of an intersex child doctors try to work out what happened during the baby's development.

They check the body's DNA containers, the chromosomes, to see whether the child is genetically female or male.

They see if the baby has ovaries or testes, and whether they have a womb or not.

They also test the hormones the body is producing and try to determine how the baby's genitals may develop.

Test results can be on a scale between male or female.

The sex is chosen as the one the doctors and the family believe that they will grow up to identify with best.

As children grow through puberty they can develop characteristics of one sex more than another, different to the sex they have been assigned as a baby.

For a child born of indeterminate sex they will undergo number of tests including those involving chromosomes, hormones and internal organs. To further complicate things the test results are not just either male or female, they can be on a sliding scale between the two.

Ultimately the sex chosen for an intersex baby is the one doctors and their family believe they will grow up to identify with best.

Dr Devore and Janet were both born at a time when parents went along with what the doctors said and surgery was seen as the first thing to do.

They have both had multiple operations. Dr Devore has had 20 surgeries, the first at three months old.

"In my view all the surgeries I suffered up to age 19 were unnecessary failures," he says.

"I lost a tremendous amount of feeling tissue that I would like to have."

Some people now believe that surgery should be left until the child can make the decision themselves.

"There are a lot of activists that describe infant surgery in one word - mutilation," explains Dr Devore.

"Unless there's a medical necessity to change the appearance of those genitals I don't think they should be cut on at all," he asserts.

"It's the kid's genitals, not the parents or the doctors and when they're young adults they are going to want them to work."

But Tom Kolon, MD Urologist at the Children's Hospital of Philadelphia points out there can be a problem with leaving it until the child has grown up.

"I think we would all want the child to be able to make the decisions themselves. The problem there is if you wait until they are old enough and mature enough to understand and say yes - have you hurt them by not doing the surgery or the medication earlier?"

Female outside, male inside

Some DSDs are not obvious at birth because they affect the internal organs and can go undiagnosed for years.

Katie has androgen insensitivity syndrome, which was only discovered when she had a hernia operation when she was six.

"I look female on the outside, I have a normal female body but instead of having XX chromosomes like a typical female I have XY chromosomes like a typical male."

Image caption Katie was 18 when her parents revealed the full extent of her condition

During her hernia operation, surgeons were surprised to find a partially descended testicle. She also had no ovaries and no womb.

Her mother and father, who are both doctors, had been trained at medical school not to tell women if they had this condition "because it would be so devastating to them that they would commit suicide".

But Katie's parents broke the mould and did tell her some of the details of the condition to prepare her.

Katie was 18 when they told her the full details, which changed her world.

"I was really scared. I was not prepared to think about myself as totally and irreversibly different to every other woman. I wondered if I would ever be loved, if I was so different I couldn't be loved," she says.

Her testes were removed and she takes pills to give her more appropriate hormones.

Katie and her mother went on Oprah's TV programme to talk about her condition and the publicity has contributed to more openness about DSDs in the US than there is in the UK.

"I think we have very inadequate definitions of what sex is," says Katie.

"But based on what we do have I can't say that I'm either male or female in terms of my sex, although my gender identity is very female."

Dr Devore would also like to see the definitions of sex widened.

"The tyranny of being forced to circle M or F (male or female) on every form I fill out, I'd like to see that change, I'd like to have a lot more options.

"Typically what I do is I circle the whole thing so it is 'MORF', M or F - that is my favourite way of responding to that question."

Me, My Sex and I will be broadcast on BBC One, on Tuesday 11 October at 22:35.