LOS ANGELES, California (CNN) -- Britney Spears has agreed to allow ex-husband Kevin Federline to retain legal custody of their two children in return for gradually increased visitation, sources close to the troubled pop star said Friday.
Britney Spears, shown leaving a custody hearing in Los Angeles in May, will gradually gain visitation rights.
By the end of the year, the sources said, Federline and Spears will split custody of 2-year-old Sean Preston and 1-year-old Jayden James evenly.
During Friday's hearing in Los Angeles Superior Court, Federline also asked for and was granted increased child support as well as $250,000 for legal fees, the sources said.
Spears' father was given conservatorship of her estate this year. Her visitation rights to the children were suspended after her odd behavior and hospitalizations but have since been restored.
In the past year, the onetime Mouseketeer has shaved her head as photographers looked on; been cited for "habitual, frequent, and continuous use of controlled substances and alcohol" by the judge in her custody case; and seen her "comeback" performance on the MTV Video Music Awards panned by critics who derided her singing, dancing, costume choice and weight.
But she recently made a critically well-received guest appearance on the television show "How I Met Your Mother."
Spears' parents obtained a restraining order against her manager in February, accusing Osama "Sam" Lutfi -- whom Spears met in October -- of drugging her and controlling her life, her finances and her exposure to photographers. The order barred Lutfi from Spears' homes and those of her family, as well as her children.