The judge ordered Federline, the father of the two boys, to take custody of Sean Preston, 2, and Jayden James, 1, starting Oct. 3.
The order came during a hearing Monday in the Federline/Spears custody case. The judge was not identified in early reports. It comes days after a judge in the same custody case concluded that Spears engages in "habitual, frequent, and continuous use of controlled substances" and demanded that she get drug tested twice weekly if she is to continue sharing custody of the children with Federline.
The judge, Scott M. Gordon, also ruled that Spears must meet with a parenting coach twice a week, and that she and Federline must receive other forms of parenting counseling. And he specified that neither parent is allowed to consume alcohol or a controlled substance 12 hours prior to taking custody of the children.
The case had not been scheduled to be reviewed again until Oct. 22. It was not clear what trigged Monday's decision to end Spears' custody. The singer has been dogged in recent weeks by constant reports of frequent partying, bad parenting and erratic behavior.
A former bodyguard recently testified that he saw her drive recklessly with her sons in the car, was apparently under the influence of narcotics in the presence of her children, and rarely