A gay dad has lost his legal battle to gain full custody of his children.

Cindy Close and her friend Marvin McMurray agreed to have a child together using his sperm and donated eggs. She became pregnant through in vitro fertilization.

After the twins were born in July, Close claims that McMurray informed her that he's gay and demanded custody of the children. McMurray said Close shouldn't have any parental rights because the children are not genetically hers.

The legal fight which ensued included Close alleging that she was duped into having children with McMurray.

A Houston judge ruled in Close's favor, declaring her the legal mother, not just a surrogate.

“I had always known I was the mom, but to have the court validate that, I was almost over the moon definitely,” Close told ABC affiliate KTRK.

Speaking on CNN, David Mattingly said the former friends “did not follow the rules.”

“She is not the biological mother but she did give birth to these children and Texas law may have been on her side here, because the law is fairly explicit when it comes to surrogacy issues,” Mattingly said. “It says that the intended parents of the child or children have to be married. There was no marriage in this case. Also there has to be a surrogacy agreement that has to be approved by the court ahead of time. There was nothing written down here.”

McMurray has said he will appeal the ruling.