(dailymail.co.uk ) - Britney Spears finally got some good news last night when a judge lifted a ban on her looking after her two young sons.
Miss Spears, 25, will be allowed three monitored visits a week with her children, which includes one overnight stay at her Los Angeles mansion.
But Superior Court Commissioner Scott Gordon warned she would be hauled back into court if she fails to undergo weekly drug and alcohol tests.
He also ruled that she must childproof her home, continue meetings with a parenting coach and ensure the youngsters are belted in car seats when they are driven around.
The nine-page ruling made public last night allows the troubled pop star two visits a week with sons Sean, two, and Jayden, one, from noon to 7pm and one from noon to 10am the next morning.
The move came a week after the judge barred Miss Spears from seeing the children altogether after she failed to make herself available for drug tests and broke other conditions for shared custody with ex-husband Kevin Federline.
A report by parenting coach Lisa Hacker said that although the singer "loves her children and the children are bonded" to her, she did not seem to have "child-centred" interactions.
The "environment at the house ranged from chaotic to almost sombre with little communication at all," Ms Hacker reported, according to the ruling.
During all three of her visits, Miss Spears "rarely engaged with the children in either conversation or play," she added.
The court ruling came after a three-hour hearing last Friday attended by both Miss Spears and Mr Federline.
The judge previously said there was evidence that Spears is a "habitual, frequent and continuous' user of drugs and alcohol.
The ruling was made a day after the pop star was seen back in the mood for partying, but her spotty skin revealed her increasingly chaotic lifestyle is starting to take its toll.
Her unsightly pimples weren't her only concern - the singer also had yet another run-in with the law.
The pop star took to the streets in an ill-fitting outfit top and miniskirt, and later changed into what looked like a Hallowe'en costume, but it may well have been yet another disastrous ensemble from her own wardrobe.
Despite being in the midst of a desperate custody battle, Britney returned to her old ways, hitting a local club with her rapidly diminishing entourage.
Unfortunately for Britney, she attracted the attention of a local police officer. Britney wasn't driving, and the star's friend and chauffer for the night was soon let go without incident.
Earlier this week she avoided a criminal hit-and-run trial by paying for damages in a crash but still faces a charge of driving without a licence.
Britney was not required to attend the hearing on the misdemeanor charges stemming from an August 6 parking lot mishap.
Superior Court Commissioner Susan Speer dismissed the hit-and-run charge after a lawyer for the pop star said his client had paid an undisclosed amount to a woman whose car was hit in a California parking lot.
But for the self-described 'Mrs. Bad Karma', as she sings on song 'Piece of Me' from new CD Blackout - there is, finally, some good news.
Despite her litany of woes, new CD, "Blackout," may be the one positive note in an otherwise dreadful year.
So far, it has earned her a Top 10 US single (with "Gimme More") and some of the best reviews she has had in ages.
And industry insiders, are saying "Blackout" could be the break Britney needs.
Rolling Stone executive editor Joe Levy, called the album "state of the art."
He said: "One of the problems for Britney right now is the public is more focused on her personal life than her music. This record is an opportunity to change that."
"A lot of people are tired of hearing about the negative stuff going on in her personal life and they'll gravitate to the new sound she's putting out," said Nate "Danja" Hills, who produced four songs on dance-focused "Blackout."
He added: "This is a rebirth. It's a new musical chapter for her."
A spokesman for Britney's label Jive Records said in a recent statement: "As Britney's label, it's not our place to comment on her personal issues, but we do care about her and support her.
"Britney's a grown woman who makes her own choices, and we respect that. But she faces challenges that most of us can't really imagine."