An American-Spanish gay couple won a custody case against a surrogate mother on Tuesday when the court ruled to hand over the charge of the 15-month-old baby girl to her biological father.

Manuel Santos, one of the partners, posted a new photo on Facebook on Tuesday that was captured just after the couple learned that they have won the custody battle. The court has ordered American biological father Gordon Lake to take care of his daughter and become her sole guardian, according to NPR. Santos, in the picture, wore a T-shirt that read “Finally, love won. Thank you, Thailand. @twogaypapas #bringcarmenhome.”

The surrogate mother gave birth to the same-sex couple’s baby in Thailand but she refused to give the custody to them after she found that the couple was gay. The Juvenile and Family Court of Bangkok gave the verdict on the child named Carmen’s custody rights. “The court has granted legal custody of Carmen Lake to Gordon Lake, my client, and (said) that my client is her only guardian,” the gay couple’s lawyer Rachapol Sirikulchit said as quoted by CBC Canada.

Both the partners had been staying in Thailand since they launched their legal battle to win Carmen’s custody after she was born in January 2015. Spaniard Santos stepped out of the court with a smile on his face and with tears in his eyes at the same time. “We won,” he told reporters. “We are really happy … This nightmare is going to end soon.” He added their daughter would finally fly to Spain after 15 months along with their 3-year-old son, Alvaro.

The gay couple in their 40s posted a message on Facebook confirming the family would move to Valencia, Spain but would like to come back to Thailand often. “Carmen is half Thai and we are very, very proud of that,” they said. “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.”