(CNN) -- A 5-year-old boy caught in a heart-wrenching custody battle will remain with his presumptive adoptive family after a judge ruled Wednesday that the biological mother had abandoned him.
It was a complex and delicate case that reached the Missouri Supreme Court and was unlikely to have a tidy ending.
Encarnacion Bail Romero was jailed after an immigration raid in 2007, after which her 6-month-old son was looked after by family and then other caretakers, arriving at the age of 2 in the home of Seth and Melinda Moser of Carthage, Missouri.
The Mosers raised the child and adopted him, giving him the name Jamison.
But Bail Romero, an undocumented immigrant from Guatemala, claims that she never gave consent to the adoption and that she has the right to be with her son, whom she calls Carlitos.
The state's highest court ruled that the mother's rights had been wrongfully terminated, throwing the Mosers' adoption in limbo. But instead of awarding the mother custody, the Supreme Court ordered a retrial where both sides could make their case.
On Wednesday, Missouri Circuit Court Judge David Jones ruled that Bail Romero had abandoned her son and that the Mosers' adoption petition will proceed.
"We're disappointed. Encarnacion is upset," said her lawyer, Curtis Woods.
Woods said he would discuss with Bail Romero the possibility of appealing the decision.
During a two-week trial in March and April, the judge heard arguments from both sides to determine in which home the child's best interests would be served. Because it was an adoption hearing, it was a closed trial, and the documents and evidence presented remain sealed.
Because of the confidentiality of the proceedings, Woods declined to elaborate on what evidence was presented during the trial.
In essence, Woods said, the Mosers' counsel argued that Bail Romero had abandoned her son and was an unfit parent. Woods said he countered with evidence that showed her to be a fit mother.
Bail Romero was anxious leading up to the ruling, he said.
"I think the whole process scares her a little bit," he said. "She says she has placed her trust in God."
After the state Supreme Court decision last year, a lawyer for the Mosers said that the couple's position had not changed: They played by the rules in adopting the boy and have provided him with a loving, stable home.
In December 2010, as they were waiting for the state Supreme Court ruling, Seth Moser said that he and his wife were the only parents the boy had ever known. They heard him speak his first words and watched him take his first steps.
The boy speaks English, like the Mosers. His biological mother speaks Spanish.
The boy's journey began when Bail Romero was imprisoned after a 2007 immigration sting at a poultry processing plant.
At first, Carlitos was looked after by some relatives, but later they sought help from a clergy couple to look after the child. That couple introduced the boy to the Mosers, who adopted him and renamed him. The judge in the original case granted the adoption by ruling that Bail Romero had abandoned her son by not contacting him or the Mosers for more than one year. But Bail Romero said she doesn't speak English and was left with no way to ask for help.
The last image she's seen of her son was a passport photo of him taken months after she was detained in May 2007. She has another son and a daughter, both older than 9, who are being raised in Guatemala by her sister.