The decision is believed to be the first in which an Australian court has forbidden a parent from administering melatonin, the use of which is widespread among parents of children with autism or ADHD.

While technically available only by prescription to adults, melatonin is the so-called “dirty secret” of many sleep-deprived parents.

It can easily be bought online, and is commonly used by parents to help their children to sleep on planes, ­recover from jet-lag, or simply to help them get some sleep.

In 2015, researchers at the University of Adelaide warned parents against using melatonin, which is also commonly used by veterinarians to change seasonal patterns for sheep and goats to make them more productive during the farm year.

Professor David Kennaway, in the Journal of Paediatrics and Child Health, said: “The use of melatonin is rather alarming … There is extensive evidence (that) it causes changes in multiple physiological systems, ­including cardiovascular, immune and metabolic systems.”

Federal Circuit Court judge Joshua Wilson was asked to ­intervene on the matter in a case known as Julius and Dunlop, which centred on the appropriate treatment of a child who finds it difficult to sleep. The boy’s parents are separated.

The child’s mother is convinced the boy is “on the spectrum” and had for years been using melatonin to get him to go to sleep.

The court heard “the father was very vocal in his condemnation of the administration of melatonin” on the grounds that “long-term consequences were likely to significantly and ­adversely affect (the child’s) health”.

The father had adopted what was described as a “sensible, commonsense and pragmatic approach”, and rather than ­administrating the hormone, “the father took (the child) for a run, thereby ­advancing his fitness while ­promoting his desire for sleep”.

The judge said the fact that the mother “had administered melatonin for as long as she did caused me to question why she did that, when the alternative to overcoming the child’s poor sleep patterns was easily achieved by exercise”.

Judge Wilson made orders under which “the mother is forbidden from administering melatonin for to the child” without the father’s consent.

The Journal of Paediatric Care last year found in favour of the effectiveness of melatonin for treating insomnia in children.