A new picture of Manuel Santos appeared on Facebook yesterday, taken shortly after he'd learned that a Thai court ruled that his husband, Gordon "Bud" Lake III — their daughter Carmen's biological father — was the baby's sole legal guardian.

It's a joyous picture of Santos, all smiles, flashing a V-for-victory sign as he jumps in the air. He is wearing a T-shirt with the words "Finally, love won. Thank you, Thailand. @twogaypapas #bringcarmenhome."

Tuesday's ruling in Thailand's Family and Juvenile Court means that Santos and Lake may soon be going home to Spain with their 15-month-old daughter, Carmen, and Alvaro, their 3-year-old son. It's the latest in a legal battle that started last fall, when the Thai surrogate who carried Carmen (who was conceived with an egg from a donor) decided she wanted to keep the baby, after learning Santos and Lake are gay.

The Thai surrogate, Patidta Kusongsaang, still has the right to appeal. She was not in court yesterday, and there's been no word so far from her or her lawyer in reaction to the court's decision. For now, this seems to put an end to what Santos calls the couple's "nightmare" after Kusongsaang decided she wanted to keep the baby. She told NPR last year that she'd made this decision after she learned Lake and Santos were "not a normal family."

Though the legally married couple had custody of Carmen, they couldn't leave Thailand with her if Kusongsaang wouldn't sign the paperwork allowing them to do so. So they stayed while the case wound its way through the Thai judicial system.

They were afraid, Lake told NPR last July, because Thailand doesn't recognize same-sex marriages and it outlawed commercial surrogacy shortly after Carmen was born. When the couple approached lawyers about fighting for their baby in court, Lake said last year, he was told their chances of winning were less than 10 percent.

"The reason they gave us such a low percentage is because, despite the fact there are temporary provisions in the new law just published that say ... parents can ask for their parental rights to be recognized in court, unfortunately, it's worded as 'husband and wife,' " Lake explained to NPR last year.

He suspected the law was written to exclude gay couples. And he seemed to be onto something.

"Thai law does not endorse same-sex pair. And [under] Thai law, a legal couple is husband and wife, man and woman," said Dr. Arkom Pradidsuwan of the Thai Medical Council in the Ministry of Public Health.

Carmen's legal status, Arkom said, was simple: She was the surrogate's baby. On Tuesday, the court disagreed.

"There is no way to express with words what we are feeling! We are crying, our family is crying, our friends are crying, and we are sure all the Thai people who showed their love for us during this time are crying too...today is a huge day for love, for family and for truth. And it is also a big day for LGBT rights," the couple posted Tuesday in Thai and English on Facebook.

Their page, called "Bringcarmenhome," has more than 131,000 likes. The overwhelming majority of those who posted in Thai since the ruling were celebrating along with the couple, and looking forward to the day Carmen can leave the country legally. There has been little public support for Kusongsaang, the surrogate.

Carmen's fathers have promised they will return someday to Thailand. Both have professed a love for the country that has been their accidental home for the past year-and-a-half.

Last summer, Santos vowed they would never leave Thailand without Carmen.

"No, no, no," he said then. "Because she's our daughter. By heart and genetically. If we have to move here and leave our families and work, we will do. But we will not leave Carmen. Because [she] is not her daughter; [she] is our daughter."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.