A baby girl should be removed from her mother and live with her father and his boyfriend instead, a judge has ruled.
The judgement follows a legal fight over the nature of the parents' agreement when the child was conceived.
The woman said they had agreed for her to be the main parent, but the father, who donated sperm, said she had agreed to be the gay couple's surrogate.
Ms Justice Russell said it was in the "best interests" of the one-year-old girl to live with her father.
The High Court case was heard in London and Birmingham earlier this year, but the decision has just been published.
"The pregnancy was contrived with the aim of a same-sex couple having a child to form a family assisted by a friend, " the judge said.
"Therefore [the girl] living with [the two men] and spending time with [the woman] from time to time fortunately coincides with the reality of her conception and accords with [the girl's] identity and place within her family."
Ms Justice Russell said the woman had used "offensive language" including "stereotypical images and descriptions of gay men" and had "insinuated that gay men in same-sex relationships behave in a sexually disinhibited manner" and were "sexually disloyal to each other".
She also said the woman had "disrupted" the men's evidence and said proceedings were "interrupted on numerous occasions" so that the woman could express breast milk.
Interruptions were "noticeably" fewer and shorter when the woman gave evidence, she said.
"[The woman] has consistently done all she can to minimise the role that [the father] had in the child's life and to control and curtail his contact with his daughter," said the judge.
"Far from being a child that she conceived with her good friend, as she describes it, her actions have always been of a woman determined to treat the child as solely her own."
The judge ruled that nothing could be reported that would identify the girl, who celebrated her first birthday earlier this year.
About 2,000 children are thought to be born to surrogate mothers every year in the UK.
The UK's current legal position is that the woman who gives birth is the legal mother, irrespective of whether the child is genetically hers. If she is married, her husband is the legal father.
Natalie Gamble, a solicitor specialising in surrogacy law who represented the fathers in the case, told BBC Radio 4's Today programme the current system left all parties involved in a surrogacy at risk of dispute.
She said the UK should looks to other countries, such as the US, for models of how surrogacy arrangements were handled "much better".
"In California, for example, there is a very clear structure for people at the outset of an arrangement," she said.
"Everybody entering into a surrogacy arrangement has psychological screening, legal advice, medical advice and support to think through all the issues and enter into a very clear contract.
"In the UK we don't have that kind of front-ended support".