A teenager has been detained after supplying ecstasy that put six children in hospital.
The 17-year-old boy, who cannot be named for legal reasons, gave the Class A pills to two 13-year-olds who then shared them with friends, also 13.
Sheriff Shirley Foran said she had handed down the eight-month sentence to the 17-year-old "as a matter of deterrence if nothing else".
The mother of one of the youngsters said she "could have strangled" him.
Kilmarnock Sheriff Court heard that the drugs were consumed by three girls and three boys.
Two of the girls met the older teenager at a retail park in Irvine, Ayrshire, and picked up the pills, which were stamped with an owl logo similar to the Trip Advisor brand.
'Under the influence'
They then went to one of the friends' houses.
Kirsty Urquhart, prosecuting, said: "The witness' mother quickly became aware that the group were under the influence of some substance and cleared the house and took her daughter to hospital.
"She also contacted as many of the other parents as she could in order that they too could be taken to hospital."
"Five children were thereafter taken to hospital and police located a sixth child to ensure her welfare and she was also brought to Crosshouse Hospital for treatment."
One of the children told officers the tablets were called Trip Advisors, the court heard.
All the children had elevated blood pressure and heart rate, consistent with having taken ecstasy and were kept in overnight for observations before being discharged the following day.
The accused admitted supplying ecstasy to two of the girls at Rivergate retail park in Irvine on 24 February.
Sheriff Foran said: "We have a number of children hospitalised here. I would be failing in my duty if I did not reflect the gravity of this offence with a sentence of detention.
"It has to be marked as a matter of deterrence, if nothing else."
The parents of one of the boys who took the ecstasy were in court to see the teenager sentenced and said he deserved custody, although they felt sorry for his parents.
The victim's mother, 38, said: "I could have strangled him at the time. We were warned that he could walk away from this with a bit of community service or a suspended sentence but he deserved what he got."