A same-sex American-Spanish couple have won a high-profile custody fight against a Thai surrogate mother who decided she wanted to keep the baby when she found out they were gay.

Bangkok's Juvenile and Family Court ruled that the legal guardian of the child, named Carmen, is the girl's American biological father, Gordon Lake, his lawyer Rachapol Sirikulchit said.

Mr Lake and his partner, Spaniard Manuel Santos, both 41, have been stuck in Thailand since launching their legal battle after Carmen was born in January 2015.

Mr Santos emerged from the court smiling and with tears in his eyes.

He told reporters: "We won. We are really happy... This nightmare is going to end soon."

"After 15 months, Carmen will fly to Spain," where the couple lives, Mr Santos added.

The case was seen as complicated by the fact that Thai law does not recognise same-sex marriages and also by a new law that bans commercial surrogacy, which took effect after Carmen's birth.

When Carmen was born, Thai surrogate Patidta Kusolsang handed over the baby to Mr Lake and Mr Santos, who left the hospital with the infant.

However, they said the mother then changed her mind and refused to sign the documents to allow Carmen to get a passport so they could leave Thailand.

Mr Lake, who is from New Jersey, is Carmen's biological father, while the egg came from an anonymous donor.

The couple were told the surrogate mother had thought they were an "ordinary family and that she worried for Carmen's upbringing", according to a message Mr Lake posted on a crowdfunding site that has raised 36,000 US dollars (£24,700) to help cover the costs of the trial and staying in Thailand.

Mr Lake has said he does not know why the surrogate claims she did not realise he was gay.

He said he was clear about that from the start with their surrogacy agency, New Life, which has branches in several countries.

The Bangkok-based New Life office has closed since commercial surrogacy was outlawed in Thailand in July 2015, following several high-profile scandals. There was a grace period provided for parents whose babies were already on the way.

Carmen has lived with the couple since her birth.

They also have a toddler son, Alvaro, who was born to a surrogate mother in India with Mr Santos the biological father.

The couple said in a Facebook post that the family will live in Valencia, Spain, but that they love Thailand and plan to come back often.

The post said: "Carmen is half Thai and we are very very proud of that.

"Right now, we just want to go back to our normal lives and try to rebuild what we can, so that Alvaro and Carmen can have the wonderful lives that they were always meant to have."

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.