A Russian court has ruled that a woman who chose to have her breasts removed cannot look after two adopted boys since she identifies herself as a man.
The long-running case of Yulia Savinovskikh affects two mentally disabled boys who were removed from her care last August.
She appealed against the decision, but now the court in Yekaterinburg, in Russia's Urals region, has said they must remain with the social services.
She insists that she is still a woman.
She says she underwent surgery because her large breasts were ruining her health.
Before her breasts were removed, she wrote a transgender blog but insists it was just fiction and a way for her to prepare psychologically for the surgery.
A higher court had asked the district court in Yekaterinburg to reconsider its ruling against Mrs Savinovskikh, but now the district court has stuck by its original decision.
The ruling, quoted by human rights lawyer Pavel Chikov, said "Yu. V. Savinovskikh's self-identification as a male and her marriage to a man, her striving to fulfil a male role in society, essentially contradict our country's family law principles, and the traditions and mentality of our society".
Her lawyer Alexei Bushmakov says another appeal will be submitted, and he is prepared to take the case to the European Court of Human Rights if necessary.
In a Facebook post, Mrs Savinovskikh acknowledges that she had her breasts removed and wrote a blog imagining herself to be a man.
Then she says: "I had no plans to have penis construction surgery, nor hormone therapy, nor change the gender in my passport."
"My children call me mum," she said.
There is widespread prejudice in Russia towards transgender and gay people. There is a ban on gay information campaigns aimed at children - including sexual health campaigns.
Mrs Savinovskikh is the birth mother of three older children. Her husband is backing her drive to get back the boys, who had been living with the family for several years.