Leah Messer, star of MTV's hit reality TV series "Teen Mom 2," received joint custody of her twin daughters Wednesday, Us Weekly reported. The reality star will share custody of 6-year-old girls Ali and Aleeah with her first ex-husband and fellow "Teen Mom 2" star Corey Simms.

"Leah is doing great," a source close to Messer told Us Weekly. "She had confidence that she would be proven right and get her custody rights back."

A West Virginia judge ruled in Messer's favor after the 23-year-old disproved accusations that she was unfit to care for her twin daughters. Simms was awarded primary custody of Ali and Aleeah in October 2015 after he blamed Messer for the twins' excessive lateness and absences from school, and a judge threw out the accusations after Messer delivered attendance records from the girls' school as proof.

Under the new custody agreement, Messer will have custody of her girls from Thursday to Sunday, and Simms will have custody of the girls from Monday to Wednesday.

"Leah and Corey will get equal time with their girls," a source close to Simms told Radar Online. "The hearing went very smoothly. They both finally came to an agreement that was best for everyone."

Messer and Simms divorced in 2011. She is also mom to 2-year-old Adalynn, whom she shares with her second ex-husband Jeremy Calvert.

Simms married his second wife Miranda in 2013, and the couple welcomed their first child together last November, as HNGN previously reported. Although the Simms' rocky co-parenting relationship with Messer has been documented on the previous season of "Teen Mom 2," sources said that both sides are working together for the children's sake.

"Everyone is getting along for the first time in a long time," a source told Radar Online. "It's what's best for the twins."