An NHS trust has won a Court of Appeal fight to overturn a landmark ruling over the use of puberty-blocking drugs for children with gender dysphoria.

Last year, the High Court ruled it was “highly unlikely” that a child aged 13 or under would be able to consent to the hormone-blocking treatment and that it was “very doubtful” a child of 14 or 15 would understand the long-term consequences.

The Tavistock and Portman NHS Foundation Trust, which runs the UK’s only gender identity development service for children, brought an appeal against the ruling in June.

In a judgment on Friday, the Court of Appeal said it was inappropriate for the High Court to give the guidance, finding it is for doctors to exercise their judgment about whether their patients can properly consent.

In their ruling, the Lord Chief Justice Lord Burnett, with Sir Geoffrey Vos and Lady Justice King, said: “The court was not in a position to generalise about the capability of persons of different ages to understand what is necessary for them to be competent to consent to the administration of puberty blockers.”

They added: “It placed patients, parents and clinicians in a very difficult position.”

The original case was brought by Keira Bell – a 24-year-old woman who began taking puberty blockers when she was 16 before later “detransitioning” – and the mother of a teenager who is on the waiting list for treatment.

During the two-day appeal earlier this year, the Tavistock’s lawyers argued the ruling was “inconsistent” with a long-standing concept that young people may be able to consent to their own medical treatment, following an appeal over access to the contraceptive pill for under 16s in the 1980s.

However, Jeremy Hyam QC, representing Ms Bell and Mrs A, argued policies and procedures at the Tavistock “as a whole failed to ensure, or were insufficient to ensure, proper consent was being given by children who commenced on puberty blockers”.

Human rights group Liberty, which intervened in the appeal, said the High Court had imposed a serious restriction on the rights of transgender children and young people to “essential treatment”.

The Court of Appeal heard the Tavistock does not provide puberty blockers itself but instead makes referrals to two other NHS trusts – University College London Hospitals and Leeds Teaching Hospitals – who then prescribe the treatments.

John McKendrick QC, for the other trusts, told the court the median age for consenting to puberty blockers is 14.6 for UCL and 15.9 for Leeds.

A Tavistock and Portman spokesperson said: “We welcome the Court of Appeal’s judgment on behalf of the young people who require the GIDS (Gender Identity Development Service) and our dedicated staff.

“The judgment upholds established legal principles which respect the ability of our clinicians to engage actively and thoughtfully with our patients in decisions about their care and futures. It affirms that it is for doctors, not judges, to decide on the capacity of under-16s to consent to medical treatment.

“We recognise the work we do is complex and, working with our partners, we are committed to continue to improve the quality of care and decision making for our patients and to strengthen the evidence base in this developing area of care.”