LOS ANGELES – Britney Spears was granted expanded visitation rights to her two sons on Tuesday during a child-custody hearing.
The longer visits are "recognition of the progress that has been made, a progress in structure and stability," said Mark Vincent Kaplan, lawyer for Spears' ex-husband Kevin Federline.
Spears left court with her mother and lawyers, smiling through tears. Federline left a few minutes later, smiling at everyone.
Click here to see photos of Britney's arrival at the courthouse.
At a post-hearing press conference, Kaplan said Federline retains custody of 2-year-old Sean Preston and 1-year-old Jayden James, but that Spears would be allowed to see them for longer periods.
"We are so pleased with Britney's progress and we are very appreciative of the court's recognition of this progress," Spears' parents, Jamie and Lynne Spears, said in a statement read by court spokesman Allan Parachini.
Federline spokesman Elliot Mintz said his client is "extremely pleased with the way things went today."
Kaplan said one of the major changes is that "there are not daily events" to undermine the situation, and that he expected to see further progress from Spears. He said "the children are doing great," adding that Federline hopes they will one day have a more constant relationship with their mother.
"Consistently, we've said that Kevin's goal and hope is that his children will have the benefit sometime in the future of having two parents actively participating in their lives," he said.
A hearing was set for July 15 to get a progress report on the new arrangement.
During a break in the hearing, Spears was seen holding her lawyer Blair Berk's hand, with red, watery eyes smudging her eyeliner. Federline went to a separate room during the break.
Earlier, Spears entered the courtroom flanked by a handful of people, including her parents and Berk. She wore a long blonde weave and a brown polka-dot dress and white sweater and seemed very somber as she was patted by her lawyer.
Federline arrived about 15 minutes later in a beige pinstriped suit with Kaplan and Mintz. Spears and Federline didn't look at each other.
FOXNews.com overheard a security guard saying that Spears was "freaking out" downstairs before the hearing began.
Moments after Commissioner Scott Gordon swore in Spears, her father and Federline, attorneys asked that reporters be removed from the courtroom, a motion Gordon granted.
Federline has had full custody of his two sons with Spears since January, when police were called to Spears' home after she refused to relinquish one of the boys to a Federline bodyguard. Spears was taken by ambulance to UCLA Medical Center.
Her visitation rights were suspended at the time but have been gradually restored in recent months.
It's been three months since Spears left a psychiatric ward a week ahead of schedule and stirred up a paparazzi car chase, a scene that looked like the beginning of even more erratic behavior. But in the weeks that followed, she largely avoided the cameras.
During that time, the 26-year-old pop star has been under the conservatorship of her father. The court-ordered arrangement put him in control of Spears' personal and financial affairs.
Since her father took over her affairs, the pop star has been relatively invisible to photographers, only occasionally snapped shopping or having dinner with her mother.
Spears' public appearances have been limited to a well-received cameo on "How I Met Your Mother," a role she reprised during a taping last week, a CBS spokeswoman said. The episode is set to air May 12.
"We're thrilled to have Britney joining us once again," series executive producer and co-creator Craig Thomas said in a statement last month. The show's audience increased by a million viewers the week Spears appeared.
The pop star also made news last month when she took on full-time exercise and nutrition coaches from Bally Total Fitness. Once known for her flawless figure, Spears was widely ridiculed for her flabby form in September 2007 during a universally panned performance on the MTV Video Music Awards that was meant to herald her comeback.
FOXNews.com's Hollie McKay and the Associated Press contributed to this report.