In Monday’s episode of the BBC documentary Countdown to Life, host Michael Mosley explores the fascinating biology of the Dominican Republic’s guevedoces: a rare groups of individuals who grow up as girls until they start developing a penis and testes during puberty. Studying these people has not only led to important drug developments but has also given insight into the biology behind human sexuality.

Chances are you’ve never heard of anyone’s sex organs spontaneously changing from female to male, but this fascinating condition affects about one in every 50 children born in the small isolated village of Salinas in the Dominican Republic, the Independent reported. Affectionately known as guevedoces, which translates into “penis at 12,” these children are often brought up as little girls until their transformation begins at puberty. This physical change from female to male is so familiar to the villagers that it is often marked by a joyous celebration.

The chromosomes that determine our sex normally do so at conception even though sex organs don’t begin to form until eight weeks into fetal development. When a fetus has a Y chromosome, it causes a surge in testosterone production that leads to the development of male sex organs. Meanwhile, if a Y chromosome is absent, the fetus will instead develop female sex organs. However, for guevedoces, who are also known as pseudohermaphrodites, an enzyme deficiency during fetal development, specifically the enzyme 5-alpha reductase, causes the male sex organs to never properly form. It’s not until puberty, when these children experience a second surge of testosterone, that the testes descend from inside the body and a penis grows.

Deficiencies in 5-alpha-reductase seem to be hereditary, which explains why pockets of pseudohermaphrodites often appear in small communities like Salinas. Higher-than-normal numbers of pseudohermaphrodites have also been documented in Papua, New Guinea, where they are referred to as turnims, which means “expected to become men.”

The condition is not life-threatening and most pseudohermaphrodites go on to live perfectly healthy lives following their dramatic sex change. But researchers have observed a long-term biological effect of their stunted 5-alpha-reductase production: smaller-than-average prostates. This observation led to the development of the drug Finasteride in the 1970s, which is meant to suppress the effects of 5-alpha-reductase in people with conditions like benign prostate enlargement and male pattern baldness.

The guevedoces’ rare start in life has also provided insight into human sexuality. Despite being brought up as girls for the majority of their lives, most young guevedoces identify strongly as heterosexuals and express a disdain for women’s lifestyles.

"I never liked to dress as a girl, and when they bought me toys for girls I never bothered playing with them. When I saw a group of boys, I would stop to play ball with them." Johnny, formally known as Felicita, explained in the BBC documentary. According to Dr Julianne Imperato-McGinley, a Cornell researcher who studied guevedoces in the 1970s, these early gender identifications would suggest that the hormones present in the womb have more of an effect on your sexual orientation than your upbringing.