LOS ANGELES - A court commissioner ruled Wednesday that Britney Spears may have visits with her two sons but did not reverse an order giving temporary custody to Kevin Federline, the pop star's ex-husband, his lawyer said.

Superior Court Commissioner Scott Gordon was expected to issue an order detailing the visitation rights, lawyer Mark Vincent Kaplan said. The order was not released by the time court closed for the day.

Federline attended the hearing but Spears did not. Her lawyer, Sorrell Trope, did not speak.

Court spokesman Allan Parachini indicated Spears would be allowed monitored visits every other day.

Federline, 29, and Spears, 25, were ordered back to court Oct. 26 for another hearing.

Flanked by bodyguards, Federline arrived in a blue suit and wearing a black patch over his right eye, covered by a pair of sunglasses. He had a sore eye and needed the patch to prevent glare, Kaplan said.

The hearing began with Federline standing and being sworn in by a court clerk before the courtroom was cleared for the private hearing. Kaplan said Spears' lawyer argued strenuously for withdrawal of the order that gave temporary custody of the boys to Federline.

Spears and Federline had shared custody of two-year-old Sean Preston and one-year-old Jayden James.

But Monday's court order for Spears to temporarily surrender them to Federline came after she failed to produce a California driver's licence and missed a court-ordered drug and alcohol test, Trope told People magazine.

A temporary driver's licence was issued to Spears late Tuesday in Santa Monica, California Department of Motor Vehicles spokesman Mike Marando said Wednesday.

"She has completed her requirements for a driver's licence,'' he said.

Among her recent problems, Spears was charged with misdemeanour counts of hit-and-run and driving without a valid licence for in a crash with a parked car in August.

Spears and Federline were married in October 2004. She filed for divorce last November and it became official in July.

Gordon previously ordered Spears to have random drug and alcohol testing twice a week after the court found she engages in "habitual, frequent and continuous use of controlled substances and alcohol.''

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

Spears has spiralled seemingly out of control since splitting with Federline, who also has a son and daughter with former girlfriend Shar Jackson. First she hit the Hollywood party circuit, where she was photographed several times sans underwear. Then she volleyed in and out of rehab, shaved her head, beat a car with an umbrella and eventually spent a month at the posh Promises rehab clinic in Malibu.

An MTV Video Music Awards performance intended as a comeback was panned, with Spears appearing lethargic. The following week, her management firm dropped her and her divorce lawyer resigned.