Britney Spears and Kevin Federline
INF; Dimitrios Kambouris/WireImage
and her ex Kevin Federline
have reached a custody settlement in their epic court battle over their two sons – averting a scheduled trial.
According to the agreement, which still needs to be signed off on by the court, Federline retains sole custody of the couple's two sons, Preston, 2 1/2, and Jayden, 1 1/2. Spears – who's currently allowed two visits and one overnight per week – will get more visitation rights.
"The case has been settled," Federline's attorney, Mark Vincent Kaplan (working with attorney James Simon), tells PEOPLE. "This is the end of a two-year journey."
Spears's attorney, Laura Wasser, said outside the courtroom after the hearing: "Britney's doing great. She's very pleased [with the settlement]. The kids are with her right now."
Without giving details, Wasser confirmed that Spears did win "more custodial time" with the boys. A source close to Spears confirms the singer will gain an additional overnight by year's end, barring any setbacks.
Spears, 26, and Federline, 30, split in November 2006. When their divorce was finalized in July 2007, they shared 50-50 custody. But things took a dramatic turn when Spears – the pop powerhouse worth an estimated $100 million – was twice forcibly hospitalized
early this year for mental health issues.
Spears lost all visitation rights with her kids until the following month, and her father Jamie stepped in to take legal control
of her affairs.
Despite the settlement, a judge can always modify custody arrangements.
"Until the kids turn 18, we can expect in years to come that Britney and Kevin will be back in court," says L.A. family lawyer Lynn Soodik, who is not involved with the case. "Britney will have a better chance of winning more custody once she regains her health. This is just the end of Round One."
E! was first to report the couple's settlement.
Reporting by BRYAN ALEXANDER