The couple’s disappointment punctuated the end of a roller-coaster day that began in the appellate courtroom, where the Huangs sobbed and hugged friends and family as the judge said they were free to go and the prosecution’s case against them was fatally flawed.

The Huangs immediately departed the courtroom with their legal representatives and sought to make arrangements to leave Qatar and fly home to reunite with their two other children, both adopted boys, from Ghana and Uganda.

“This has been an emotional trial for me and my family,” Mr. Huang said in a statement he read outside the courtroom. “Grace and I want to go home and be reunited with our sons. We have been unable to grieve our daughter’s death. But we want to thank the judge for today’s decision.”

Asked outside the court what she was looking forward to the most, Mrs. Huang said, “Seeing our kids, seeing our sons.”

The parents spent nearly a year in prison before their case was heard for the first time last November, when they were released on their own recognizance but ordered to remain in Qatar. Their other two children already had been sent home to the United States in the custody of Mrs. Huang’s mother.

In March, the couple were found guilty of a reduced charge, child endangerment, and sentenced to three years in prison. They appealed to have the verdict dismissed, while prosecutors sought a more severe sentence. The Huangs were ordered to remain in Qatar pending the appeals court decision.

On Sunday, the appellate judge, Abdul Rahman al-Sharafi, discredited the prosecution’s case point by point in his ruling, a highly unusual development in the Qatari judicial system, where prosecutors and the police are often heavily favored.