Updated

Britney Spears won modified visitation rules Thursday that allow her two boys to spend one overnight a week with her, and the pop star's attorney requested her mother become the required court-appointed monitor.

Spears made a surprise appearance in court after Superior Court Commissioner Scott Gordon held a morning hearing on her emergency request to expand visitation but declined to rule. He gave attorneys for Spears and her ex-husband, Kevin Federline, who was recently granted custody, more time to discuss the matter outside court.

Spears was previously allowed monitored visits with the children but no overnight stays. Neither she nor her attorneys spoke to reporters after the closed, afternoon hearing.

During the earlier open hearing, Spears' attorney, Anne Kiley, argued that overnight visits were critical for Spears to bond with her sons, 2-year-old Sean Preston and 1-year-old Jayden James.

"I do think it is an emergency for them not to have overnights with their mother, which they've always had," she told Gordon.

"What possible concern can he (Federline) have if there are monitors present?" she asked.

Superior Court spokesman Allan Parachini announced the new visitation order but he could not say who would be the overnight monitor.

Federline, who was not at the hearings, agreed to the modification, his attorney, Mark Vincent Kaplan, said outside court.

"He agreed — didn't have to — but he agreed that he would allow that I'm doing good." She sipped from a Coca-Cola can as she approached the courtroom. An attorney took it from her and placed it on a bench as she entered.

Spears played nervously with her jeans pocket as she stood to be sworn in.

The commissioner allowed Spears to keep her dark sunglasses on, telling her, "I understand you have a medical condition." The condition was not disclosed.

Reporters were then asked to leave and the hearing continued behind closed doors.

She spent about an hour in the courtroom, then drove off in a white Mercedes-Benz swarmed by news media at a stop light. She escaped only after sheriff's deputies ran from the courthouse to aid her.