LOS ANGELES - Britney Spears' legal problems continued Monday when a judge ordered her to surrender custody of her children to ex-husband Kevin Federline.

Superior Court Judge Scott M. Gordon ruled that Federline will take custody of Sean Preston, 2, and Jayden James, 1, beginning Wednesday, "until further order of the court.''

The order stemmed from an unspecified oral motion made by Federline's attorneys and was handled in a closed-door hearing. The judge's order didn't state the reason for the change in custody and all transcripts of the proceedings were ordered sealed.

Phone messages left for representatives of Spears and Federline were not immediately returned Monday.

Last month, Gordon said Spears engaged in "habitual, frequent and continuous use of controlled substances and alcohol.'' He ordered the pop star to undergo random drug and alcohol testing twice a week as part of her ongoing custody dispute with Federline.

Spears also was previously ordered to meet weekly with a "parenting coach'' who was to observe and report back to the court about her parenting skills. Both Spears and Federline must complete the court's "Parenting Without Conflict'' class.

Spears, 25, and Federline, 29, were wed in October 2004. She filed for divorce last November and it became official in July. The two have joint custody of their sons, but Federline is seeking a greater share of custody.

Since Spears became single, her troubles have played out in the tabloids. First she was photographed at various Hollywood hotspots partying with Paris Hilton. Some photos captured Spears without panties. Then Spears shaved her head, beat a car with an umbrella and ended up spending a month in rehab.

She was born in McComb, Miss., although she has lived in Los Angeles for many years. Spears was a child performer, a member of Disney's New Mickey Mouse Club and even appeared on (and failed to win) "Star Search.'' In 2000, her solo music career exploded and she has remained in the headlines ever since.

Many of her latest problems are said to revolve around substance abuse.

Former bodyguard Tony Baretto told NBC's "Today'' show that he saw Spears using drugs at a nightclub twice in the same night soon after she got out of rehab.

An MTV Video Music Awards appearance last month meant to herald her comeback was universally panned for her lacklustre performance. The following week, Spears' management firm dropped her and her divorce lawyer resigned.

She then was charged with misdemeanour counts of hit-and-run and driving without a valid licence for allegedly crashing into a parked car in August.

Authorities said the accident occurred Aug. 6, when she was filmed by paparazzi steering her car into another vehicle as she tried to turn into a spot in a parking lot. Spears is scheduled to be arraigned in that case Oct. 10, but she is not required to appear.

It's claimed she has never held a valid California diver's licence, although she has applied for one.

Spears' new album will be released Nov. 13.