After a hearing that lasted almost three hours Wednesday, a Los Angeles judge has decided that Kevin Federline will retain custody, while Britney Spears will get supervised visitation of the couple's children.

"This was a step forward for the pop star, who lost custody to her ex-husband earlier this week when she failed to meet a few of the court's requirements. Spears wasn't required to hand over Sean Preston and Jayden James until Wednesday at noon, but she handed them over Monday, according to the couple's previous 50/50 custody arrangement. She then promptly took steps to get her children back, including getting a temporary driver's license in the state of California on Tuesday.

Commissioner Scott Gordon recognized those efforts after a closed hearing in chambers, and modified his custody ruling so that the couple share joint full custody, with Federline as the primary custodian, for now. Gordon ruled that while Spears' attorney offered evidence of compliance of his previous orders (see "Britney Spears Must Undergo Regular Drug Testing, Parenting Classes In Custody Case"), the singer was not in complete or "substantial" compliance, according to court order's released Thursday (October 4). Gordon stressed that Spears must take the order for random drug testing more seriously, ruling that missing a test, refusing to submit a test or failing to respond to a testing agency's call would all constitute a failed test.

Gordon also stressed the importance of the counseling sessions he had previously prescribed, ordering that Spears complete at least three individual counseling sessions by the next hearing and that she complete at least three joint parenting-counseling sessions with Federline by the next hearing as well. Gordon also ordered Spears to submit proposals for parenting coaches and counselors within 24 hours.

Spears did not attend Wednesday's hearing, however, while Federline, sporting an eye-patch, did. His lawyer, Mark Vincent Kaplan, told reporters outside the courthouse following the hearing that Federline made his appearance to introduce himself to the court. "We felt [the custody] orders were justified and Kevin was pleased with the orders in place," Kaplan said. The next hearing in the couple's custody case will be held October 26, and Spears and Federline are required to be there.

Legal experts had predicted that the most Spears could hope for in the hearing would be to win visitation rights, since it will be a slow process before she and Federline can share 50/50 custody again (see "Britney Spears, Legally Speaking: Top Lawyers Say She Can Get Kids Back, If She Follows Advice"). New York divorce lawyer Lois Liberman estimated that Spears would be allowed one- to two-hour supervised visits before she could build to longer stays, such as overnights or weekends, and it would take at least three months of clean drug-testing before the court would consider allowing Spears unsupervised visits with her children. "The court is going to err on the side of caution now," Liberman said. "It will be a gradual opening of the floodgates. But the court's goal is to reunite the family in some fashion."

The couple's new custody arrangement resembles the one they shared in January and February of this year, when Spears had full custody and Federline was allowed visitation — though that was for three days a week and four hours at a stretch and with no required supervision. While the court didn't give specifics on the new arrangement — such as how many hours for how many days — Los Angeles Superior Court public information director Allan Parachini did tell reporters outside the courthouse that Spears would get several days a week for visitation, possibly as much as every other day. Gordon's ruling specifies that Spears must pick up the tab for the monitoring, which can be done by either a parenting coach or other professional selected by the court. The monitor is to terminate any visit if it appears the children are endangered and inform both parents as well as the court in writing if any termination occurs.

[This story was originally published at 8:45 pm E.T. on 10.3.2007]