Mama June just scored a legal win -- a court ordered that she'll retain custody of her late daughter Anna "Chickadee" Cardwell's daughter, Kaitlyn.
TMZ got their hands on the court docs ... a Georgia judge ruled legal and physical custody of Kaitlyn will stay with Mama June ... this after Michael Caldwell -- Anna's ex who was not Kaitlyn's biological father -- tried to obtain custody rights.
As InTouch first reported ... the court ruled that Michael won’t have any visitation rights unless Mama June and Kaitlyn agree otherwise. The legal order mentioned Kaitlyn expressed her wish to keep living with her grandmother during her testimony at a July hearing.
The judge also pointed to testimony from the family therapist noting that Kaitlyn was scared of being taken away from Mama June.
Kaitlyn, 11, had moved in with June before Anna passed away last December after a yearlong cancer battle.
Even though Michael is not Kaitlyn's biological father, he claimed in legal docs he'd taken on a parental role in Kaitlyn's life over the years.
But back in January, a judge gave June temporary custody ... and this order shows that will be the situation moving forward.