Updated

State child welfare authorities on Friday appealed a stinging court ruling that said their seizure of more than 440 children from a polygamist sect's ranch was unjustified, but they also agreed to reunite 12 children with their parents while the case moves on.

The agreement narrowly specifies 12 children, some of whose parents had filed a motion with a state district court in San Antonio for their release from state foster care.

Child Protective Services spokesman Patrick Crimmins declined to comment on the agreement.

CPS agreed to allow the parents to live with their children in the San Antonio area under state supervision, said Teresa Kelly, a spokeswoman for Rene Haas, an attorney for the parents. The families cannot return to the Yearning For Zion ranch, where they lived before the raid.

Aside from mothers staying with their infants in foster care, no other parents from the west Texas ranch have been allowed to stay with their children.

CPS's case for removing all children from the ranch was thrown into doubt Thursday when the Third Court of Appeals ordered a lower-court judge to rescind her decision giving the state custody of more than 100 of the children. The ruling was broad enough to cover nearly every child swept up in the April raid on the ranch run by the Fundamentalist Church of Jesus Christ of Latter Day Saints.

CPS said in its appeal to the Texas Supreme Court that the appeal court was wrong to say that the vast majority of children at the ranch did not face the sort of extreme danger state law requires for them to be removed without a court order. The agency cited evidence it said showed that the church pushed teenage girls into spiritual marriages with older men.

"This case is about adult men commanding sex from underage children; about women knowingly condoning and allowing sexual abuse of underage children; about the need for the department to take action under difficult, time-sensitive and unprecedented circumstances," the state agency said in its appeal.

The state asked to keep the children in foster care while the case is reviewed.

The limited agreement CPS offered covers 12 children, but it was unclear how many families that includes. Kelly said three of the children belonged to one family who had asked the court for their children's release. Kelly didn't know why the other nine children were attached to the agreement.

Lori and Joseph Jessop had been scheduled to appear in Bexar County district court on their motion to release their three children — ages 4, 2 and 1 — but CPS offered the agreement instead, Kelly said.

Similar agreements in the near future are unlikely; the couple filed their motion in a different court than the other families.

State officials said in their Supreme Court filing that it would be impossible to return all children covered in Thursday's ruling because they have not determined which children belong to which parents, and DNA tests were incomplete. The appeals court ruling technically applies only to the 38 mothers who filed the complaint.

In justifying their removal of the children from the ranch, Child Protective Services cited as "documented" sexual abuse a statement from a girl who said she knew a 16-year-old who is married with a 5-month-old baby; and the statement from another girl that "Uncle Merrill" decides who and when she will marry. The state also cited five underage pregnant girls.

Authorities also said the appeals court overstepped in its ruling because a lower court had discretion to rule in the custody case.

Attorneys for the parents whose case is under high-court consideration urged the justices to reject the state's appeal, saying their children "are being subjected to continuing, irreparable harm every day that they are separated from their parents."

Rod Parker, a spokesman for the Fundamentalist Church of Jesus Christ of Latter Day Saints, said the appeal was no surprise "although one would hope that at some point they would realize the futility."

The parents were prepared for an extended legal battle, he said.

"They're hopeful to get on with their lives, but in reality, they understand," he said.

The agency accused parents of being uncooperative and not providing proper identification — though in dozens of individual custody hearings this week, parents provided state-issued birth certificates. Other sect members mistakenly believed to be minors also provided drivers' licenses as proof of their age.

The Third Court of Appeals said the state acted hastily.

"Even if one views the FLDS belief system as creating a danger of sexual abuse by grooming boys to be perpetrators of sexual abuse and raising girls to be victims of sexual abuse ... there is no evidence that this danger is 'immediate' or 'urgent,"' the court said.

"Evidence that children raised in this particular environment may someday have their physical health and safety threatened is not evidence that the danger is imminent enough to warrant invoking the extreme measure of immediate removal," the court said.

The children were taken into custody more than six weeks ago after someone called a hot line claiming to be a pregnant, abused teenage wife. The girl has not been found and authorities are investigating whether the calls were a hoax.

Five judges in San Angelo, about 40 miles north of Eldorado, had been holding hearings on what the parents must do to regain custody when the appeals decision was issued. Those hearings were suspended after Thursday's ruling.

The custody case has been chaotic from the beginning. During the first round of hearings, held two weeks after the April 3 raid, hundreds of lawyers crammed into a courtroom and nearby auditorium, queuing up to voice objections or ask questions on behalf of the mothers, who were dressed in trademark prairie dresses and braided hair.

The state conceded this week that at least 15 of the 31 mothers being held in foster care as minors were actually adults; one is 27.

The state has struggled for weeks to establish the identities of the children and sort out their tangled family relationships. The youngsters are in foster homes all over the state, with some brothers or sisters separated by as much as 600 miles.