Germany has become Europe's first country to allow babies with characteristics of both sexes to be registered as neither male nor female.
Parents are now allowed to leave the gender blank on birth certificates, in effect creating a new category of "indeterminate sex".
The move is aimed at removing pressure on parents to make quick decisions on sex assignment surgery for newborns.
However, some campaigners say the new law does not go far enough.
As many as one in 2,000 people have characteristics of both sexes.
'Bruised and scarred'
They are known as "intersex" people because they have a mixture of male and female chromosomes or even genitalia which have characteristics of both genders.
The intense difficulty for parents is often that a gender has to be chosen very quickly so that the new child can be registered with the authorities, the BBC's Steve Evans in Berlin reports.
Sometimes surgery is done on the baby to turn its physical characteristics as far as possible in one direction or the other, our correspondent says.
The law in Germany has been changed following a review of cases which revealed great unhappiness.
In one case, a person with no clear gender-defining genitalia was subjected to surgery. The person said many years later: "I am neither a man nor a woman. I will remain the patchwork created by doctors, bruised and scarred."
German passports, which currently list the holder's sex as M for male or F for female, will have a third designation, X, for intersex holders, according to the interior ministry.
It remains unclear what impact the change will have on marriage and partnership laws in Germany.
Current laws define marriage as a union between a man and a woman, and civil partnerships are reserved for same-sex couples.
Silvan Agius of IGLA-Europe, which campaigns for the rights of lesbian, gay, bisexual, transsexual and intersex people, said the law needed to go further.
"While on the one hand it has provided a lot of visibility about intersex issues... it does not address the surgeries and the medicalisation of intersex people and that's not good - that has to change," he told the BBC.
While Germany is the first country in Europe to legally recognise a third gender, several other nations have already taken similar steps.
Australians have had the option of selecting "x" as their gender - meaning indeterminate, unspecified or intersex - on passport applications since 2011. A similar option was introduced for New Zealanders in 2012.
In South Asia, Bangladesh has offered an "other" gender category on passport applications since 2011.
Nepal began recognising a third gender on its census forms in 2007 while Pakistan made it an option on national identity cards in 2011.
India added a third gender category to voter lists in 2009.
While transgender or intersex people have long been accepted in Thailand and are officially recognised by the country's military, they do not have any separate legal status.