A judge in South Africa found a woman guilty Thursday of kidnapping a newborn nearly two decades ago from a hospital and raising the girl as her own.

Judge John Hlophe in Cape Town convicted the woman of kidnapping, fraud and contravening child protection laws, said Eric Ntabazalila, spokesman for the National Prosecuting Authority. The judge revoked bail and the woman will be detained until her May 30 sentencing, he said.

“Your story if anything is a fairy tale and the court rejects it with the contempt it deserves,” Hlophe told the grim-faced woman, according to Sky News. He ordered that neither the defendant nor the girl may be identified.

Hlophe mentioned in court that the woman could be looking at a 10-year prison sentence.

The girl's biological mother, Celeste Nurse, sobbed loudly as the verdict was delivered amid chants of “Yes! Yes!” from the public gallery inside the courtroom, Sky News reported.

State prosecutors said the woman snatched the three-day-old baby from her sleeping mother's hospital bedside in Cape Town in April 1997. The prosecution also said the woman defrauded authorities when she registered the child as her own daughter in 2003, also changing her birthdate.

The defendant, now 51, pleaded not guilty to all three charges. During the trial she testified that she adopted the child.

"I didn't know the baby was stolen," the woman testified, according to the African News Agency.

The woman had told the court in earlier proceedings that she had adopted the baby after struggling with infertility. She said she was not aware the child was kidnapped. The woman who facilitated the adoption told her a young woman had given the child up, she said.

The girl reportedly was reunited with her biological parents, Morne and Celeste Nurse, last year after their second daughter befriended a girl at school who looked remarkably like her. After a police investigation and DNA tests, that new friend turned out to be the Nurses' missing child.

The biological parents sobbed as the judge read the verdict, ANA reported, capping off an emotional trial.

Morne Nurse, the girl's biological father, told the court in February that he was “crying my heart out in the fetal position” on the day the baby disappeared.

The girl, now 18, was not in court and is taking high school final exams.

Click for more from Sky News.

The Associated Press contributed to this report.