For children living in unstable or dangerous homes, the foster care system can give them an invaluable chance to be taken care of by a loving, caring family. But it’s no secret that it’s also a complex, imperfect system with plenty of pitfalls. On Monday, 6-year-old Lexi was removed from her foster home in Santa Clarita, California, according to CNN, following a long legal battle about where the child — who is of Native American heritage — should be raised. Her foster parents, Rusty and Summer Page, have argued that it is in Lexi’s best interests to stay with them, in the home she has lived in for the past four years — and on the surface, that seems hard to argue. So why is Lexi being removed from her foster home?

Even though Lexi appears to have found a dedicated, stable family to be part of, legally, the decision is much more nuanced. According to CNN, since Lexi’s father is a member of the Choctaw tribe (Lexi is 1/64th Choctaw), Lexi’s case falls under the jurisdiction of the federal Indian Child Welfare Act, a law that is meant to preserve the rights of tribal families, and keep them together whenever possible. According to the Washington Post, the National Indian Child Welfare Association said that when the Pages took Lexi in as a foster child, they knew that the Indian Child Welfare Act would prioritize reunification between Lexi and her Native American family members. And now that it’s possible for Lexi to once again be part of her (extended) biological family, legally, the Pages don’t have much of an ability to keep that from happening.

In a statement following the removal of Lexi from her foster home, the National Indian Child Welfare Association said,

Court transcripts indicate the Pages were aware since 2011 that their foster daughter had loving relatives wanting to welcome her into their home and reunite her with her siblings, one of whom she will now live with...As with most foster placements, where reunification with family is the stated objective, the Page family understood their placement was to be temporary.

Of course, being aware of the law and agreeing to it when a foster child is first put in your care doesn’t prevent you from wanting the situation to be different once four years have passed. According to U.S. News & World Report, the Pages’ attorney, Lori Alvino McGill, indicated that Summer and Rusty want to legally adopt Lexi, and that they will be appealing the reunification decision, taking the case to the California Supreme Court if they have to.

Speaking to People magazine, McGill argued that, despite the good intentions of the Indian Child Welfare Act, it didn’t apply in Lexi’s case and wouldn’t be in her best interest:

The law was passed…because of concern that [Native American] families and communities were being broken up for no good reason. They wanted to put a stop to that and so they responded by enacting a law that was meant to keep families and communities together and to make it more difficult for social workers to split families apart. But they wrote a law that reads much more broadly than that and can apply to children like Lexi who were not removed from a [Native American] family.
[Lexi] was removed from an Hispanic mother, and just because her biological father has some [Native American] ancestry, a whole different set of rules apply to her placement.

According to CNN, court papers indicate that Lexi was 17 months old when she and her six other siblings were removed from their mother’s custody, due to a “lengthy substance abuse problem.” Lexi's father became her primary caregiver, according to the Indian Country Today Media Network, but was sent to jail in 2010 “for grand theft auto and selling stolen auto parts,” when Lexi was a year old. While he initially worked to get Lexi back following his release, he eventually agreed to a “preferred placement” provision, which would give primary guardianship of Lexi to his relatives, while still allowing him to maintain a relationship with his daughter. As a result it was decided that Lexi would live with relatives of her father who live in Utah — including one of Lexi’s sisters — even though they are not actually Native American themselves.

Leslie Heimov, Lexi's court-appointed legal representative from the Children's Law Center of California, explained that reuniting Lexi with her siblings was an important factor in the decision to remove her from the Pages’ home, according to the Los Angeles Daily News:

The law is very clear that siblings should be kept together whenever they can be, and they should be placed together even if they were not initially together...She has a loving relationship with [her extended family], and [they] are not strangers in any way, shape or form.

The Pages have also received criticism for allowing Lexi’s identity and personal details to become public. The National Indian Child Welfare Association criticized the Page family for “the media spectacle” surrounding her case, saying in a statement that,

It was regrettable and disturbing to observe, [and] stands in stark contrast to best practice that ensures a child’s safe transition in such circumstances. Transitioning a child from a foster care placement to family should be done in a manner that creates the least amount of unnecessary trauma for a child. This is why such matters are kept private — because child development experts and families understand it is in the child’s best interest to do so.

Heimov also argued, according to CNN, that the Pages only made things more difficult for Lexi by pursuing years of lengthy litigation that just prolonged the pain she would experience, saying,

She would have been 3 or 4, instead of 6, when the exchange happened if the foster parents had relinquished custody sooner.

But the Pages, for one — and the community that has rallied around them during their fight — do not agree that any of the legal decisions made in Lexi’s case are actually in her best interest. They argue that they and Lexi formed a strong bond with each other, and that, in their care, she had overcome some of the signs of reactive attachment disorder that she’d been exhibiting, according to People. Rusty told the magazine,

For the first six months she was with us if we tried to pick her up she would dig her nails into our arms as if we were about to throw her. We spent months just cradling her to get to the point where she could trust us to pick her up...We poured our hearts and souls into helping her recover.

From a legal perspective, however, it seems unlikely that Lexi will be returned to the Pages now that she has been taken away. According to the Associated Press, Stanford Law professor Ralph Richard Banks said,

[although] there is still considerable disagreement over the application of the law and whether it serves children's best would be fairly extraordinary for an appeals court to reverse [the decision in Lexi’s case].

Regardless of how this heartbreaking (and polarizing) custody case ends, the best that anyone can hope for is that Lexi’s wellbeing and happiness is prioritized — whichever family she ends up remaining part of.