A Connecticut teenager at the center of a custody dispute based on conflicting medical diagnoses was returned to her parents on Wednesday morning.

The decision came after a Massachusetts judge on Tuesday, June 17 ordered the release of Justina Pelletier, of West Hartford who had been the focal point of a 16-month, two-state dispute that revolved around whether she had a disease of the cellular system or a psychological disorder.

Lawyers from the Liberty Counsel, which bills itself as an international nonprofit litigation, education, and policy organization dedicated to advancing religious freedom and family issues, had pushed for her release.

The group’s website released the following statement: “We are thrilled that Justina will finally be returning home. The family looks forward to putting this 16-month nightmare behind them. Justina and her family now begins the process of healing both physically, emotionally, and spiritually.”

The Hartford Courant quoted Matthew Staver, Liberty Counsel’s founder, as saying the Orlando, Fla., -based group had worked with the family for the past three months. Staver had filed a motion on May 30 stating that the Pelletier family had complied with the terms of a reunification plan issued by John W. Polanowicz, the Massachusetts secretary of Health and Human Services. That department oversees the Massachusetts Department of Families and Children.

Polanowicz said the decision to release the teenager was the result of the state’s collaboration with the Pelletier family to create a reunification plan. “The court’s ruling reflects a thorough review of this complex case, and we are very pleased with the result,” Polanowicz said.

Tufts Medical Center had treated Justina for mitochondrial disease, a disorder that affects cellular energy production. But in early 2013, her doctor transferred from Tufts to Boston Children’s Hospital, where other physicians said her physical symptoms — which included weakness, headaches and abdominal pain — were psychologically induced. They diagnosed Justina with somatoform disorder, a mental disorder.

When her parents rejected that diagnosis and tried to take her back to Tufts, the Massachusetts Department of Children and Families took custody of Justina, prompting the dispute.

Though it’s rare, state authorities can take custody of a child when they feel parents are failing to get the child proper medical care. “It doesn’t happen frequently, but if a complaint of medical neglect does come up, it will usually end up in court,” Martha Stone, the founder and executive director of the Center For Children’s Advocacy in Hartford, told the Law Tribune earlier this year. “In these cases, there are often differing medical opinions.”

Court hearings often come down to a battle waged between medical experts. “The age of the child, the family history, how common is the medical issue described, those are generally questions that will be asked in these cases,” Stone said.

Pelletier’s family said the girl currently has no feeling below her hips and uses a wheelchair to get around. They also said they plan to pursue legal action against Massachusetts officials and legislative action to change Massachusetts law governing such circumstances.