
Since separating from Federline last November, Spears, 25, has been in and out of rehab, photographed without underwear, shaved her head and struggled to stage a comeback.
Los Angeles Superior Court Commissioner Scott Gordon did not give a reason for his decision in a written ruling.
But he was the same judge who two weeks earlier ordered Spears to undergo random drug testing and to hire a parenting coach after finding evidence of "habitual, frequent and continuous use of controlled substances and alcohol."
Four days after that hearing, Spears was charged with hit-and-run and driving without a valid license in relation to an accident in a parking lot in August.
Spears's attorney, Sorrell Trope, told People magazine that they were not able to prove compliance.
"Specifically the judge ordered that by 10 a.m. (Monday) morning, both parties show valid California driving licenses. I've been unable to produce evidence of that," he said.
Trope said another reason behind the judge's temporary custody ruling "was a claim by Mr. Federline's attorney that she had not complied with a previous order the court had made - before I came on board (as lawyer) -- about having a random drug and alcohol test." "There's no evidence that she actually failed a test," he added.Another hearing is set for Wednesday.Representatives for Spears and Federline were not immediately available for comment.