Teen Mom 2 star Leah Messer, who left rehab in June, has lost primary custody of her twins, Ali and Aleeah, 5, In Touch magazine has exclusively learned.

The girls’ father (and Leah’s ex-husband), Corey Simms, “was awarded primary custody, effective immediately” on Oct. 13, a source exclusively reveals.

RELATED: Cops Called on ‘Teen Mom 2’ Star Leah Messer — Find Out Why

Leah with her daughters Ali, Aleeah and Addie.

“Leah only gets the girls on the weekends now,” a family insider adds.

Corey first fought for custody in 2014 after reports surfaced that Leah was abusing prescription pills (a judge ruled in her favor after a negative drug test). “Leah’s really been screwing up since then, so Corey took her back to court. The judge looked at the girls’ school records, which show that they’ve been late for school, and made the change in custody.”

RELATED: More Baby News For Leah Messer’s Family!

But her fight doesn’t end there. Leah’s other ex-husband, Jeremy Calvert, now may seek primary custody of their daughter, Addie, 2.

Jeremy Calvert and Corey Simms.

“Everyone is very worried about Addie. She recently wandered out of the house while Leah was distracted,” claims the family insider. “Thankfully, a police officer found Addie and brought her back home.”

RELATED: Did ‘Teen Mom 2’ Star Corey Simms Cheat On His Pregnant Wife With Leah Messer?

“If [Jeremy] can find [a job] nearby, he’ll go for the same custody arrangement that Corey did,” the insider tells In Touch. (Jeremy’s current job has him traveling for weeks at a time.)

For more on Leah’s custody battle, pick up the latest issue of In Touch magazine, on newsstands now!