An appeal court has ruled that US officials had no right to seize 463 children from a polygamist sect in western Texas last month.
The court said that the reasons given for the children's removal were "legally and factually insufficient".
But it did not immediately order the return of the children to the ranch.
In April, officials raided a compound of the sect, saying young girls were being forced into marriage and sex. The children were placed into foster care.
But the Texas Third Court of Appeals ruled that officials failed to demonstrate the children were in any immediate danger, which is the only legally allowable reason for taking children from their homes without court proceedings.
The Fundamentalist Church of Jesus Christ of Latter Day Saints has denied abuse and says it is being persecuted.
Archive scenes at a Texas courthouse
Correspondents say the case, which began with a raid on 3 April, has been marked by confusion.
So far, 168 mothers and 69 fathers of the children have been identified - reflecting the polygamist practices of the sect - the Associated Press news agency reports.
More than 100 children have still not been matched with mothers.
Some of the parents say they do not know where their children have been placed, while others have complained that their sons and daughters are living at different locations, forcing them to criss-cross Texas to see them.
Officials have said that several of the sect members they had listed as minors are in fact adults.
They said the situation was complicated because some women and children had given different names and lied about ages.
Initially, officials said more than half of the underage girls were either mothers or were pregnant.
The children were taken from the sect's Yearning For Zion ranch
The legal age of sexual consent in Texas is 17 and polygamy is illegal in the US.
The children were removed from the Yearning For Zion Ranch in Eldorado after someone called a domestic abuse hotline claiming to be a pregnant 16-year-old abused by a much older husband.
The girl has never been found and authorities are investigating whether the calls were a hoax.
Earlier this month, investigators said they had found signs of physical injuries among the children, but added it was unclear whether these were due to abuse.
Members live in large extended families, making it hard to determine exact parenthood, and the state is using DNA tests in its investigation.
The Fundamentalist Church of Jesus Christ of Latter Day Saints (FLDS) is an offshoot of the Mormon Church.
It broke away from the mainstream Mormons more than a century ago.
FLDS members are taught that a man must marry at least three wives in order to ascend to heaven.
The church denies forcing young girls into polygamy.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.