(CNN) A Hamilton County, Ohio, judge on Friday gave custody of a transgender teen to his grandparents rather than his parents, allowing them to make medical decisions regarding his transition.

The parents didn't want the teen, a 17-year-old who identifies as male, to undergo hormone treatment and refused to call him by his chosen name, triggering suicidal feelings, according to court testimony. The parents wanted custody in order to make medical decisions for the teen and prohibit the treatment that his medical team had recommended.

Judge Sylvia Sieve Hendon had instructed that the family's names not be released.

Hendon's ruling says that in addition to receiving custody, the grandparents can petition to change the child's name in probate court. The teen will now be covered by the grandparents' insurance.

The grandparents, rather than parents, will be the ones to help make medical decisions for the child going forward. But before any hormone treatment is allowed, the court ordered, the teen should be evaluated by a psychologist who is not affiliated with the current facility where he is receiving treatment, on "the issue of consistency in the child's gender presentation, and feelings of non-conformity."

A team at Cincinnati Children's Hospital Medical Center, where the teen has been treated since 2016, advised the court that he should start treatment as soon as possible to decrease his suicide risk.

The parents' attorney had argued that the child was not "even close to being able to make such a life-altering decision at this time." A county prosecuting attorney argued that the parents wanted to stop the treatment because it violated their religious beliefs.

In the custody decision, Hendon said the parents will have visitation rights and are "encouraged to work toward a reintegration of the child into the extended family."

She also encouraged Ohio lawmakers to create legislation giving judges a framework in which they can evaluate a patient's right to gender therapy.

"What is clear from the testimony presented in this case and the increasing worldwide interest in transgender care is that there is certainly a reasonable expectation that circumstances similar to the one at bar are likely to repeat themselves," she wrote. "That type of legislation would give a voice and a pathway to youth similarly situated as (the teen) without attributing fault to the parents and involving them in protracted litigation which can and does destroy a family unit."