Singer Britney Spears has been ordered to hand over her two young children to her former husband.
Los Angeles judge Scott Gordon said Kevin Federline should be given custody of Sean Preston, two, and one-year-old Jayden James, until "further notice".
The couple had shared custody and the reason for the change was not given.
The decision comes two weeks after the same judge said the pop star engaged in "habitual, frequent and continuous use of controlled substances and alcohol".
'Nudity and drug use'
At that hearing, he ordered the 25-year-old singer to undergo random drug and alcohol testing twice a week.
Both parents were told to complete a parenting class and Spears was ordered to have weekly meetings with a "parenting coach".
The judge has not explained whether or not she carried these out successfully.
But on Monday, he ruled that Federline "is to retain physical custody of the minor children on Wednesday October 3, 2007 at 12pm until further order of the court".
Ms Spears' former bodyguard said he would testify against the star
Spears' former bodyguard Tony Barretto, 28, who claimed he was sacked by the star, said he was prepared to testify against her during the custody battle.
He has said there were "issues of nudity by Ms Spears, drug use, and safety issues involving the children post-rehab".
The judge's order came 10 days after the singer was charged with leaving the scene of an accident after allegedly driving into a parked car, and driving without a valid licence.
If found guilty she could go to jail for six months.
She was also dropped by her management firm last month following her so-called comeback performance at the MTV Video Music Awards, which was panned by critics.
Ms Spears married Mr Federline, then a backing dancer, in October 2004, but the pair filed for divorce last November.
The divorce was finalised on 30 July and since then, the estranged couple have shared an equal amount of time with the two boys.
However, Mr Federline has been fighting for greater time and more money.
Representatives for Spears and Federline were not immediately available for comment.