An assistant headteacher performed a sex act just inches from the face of a sleeping boy during a Christmas party and sleepover, a court has heard.
Matthew Hill, 40, of Mallory Crescent, Fareham, Hampshire, is on trial for a count of outraging public decency for the incident which happened at the Buckland play centre in Portsmouth, in the early hours of December 23 2012.
Iain Wicks, prosecuting, told Portsmouth Crown Court that Hill was working at the time as the assistant headteacher at Lyndhurst Junior School in the city - but was helping out at the play centre as a volunteer for the event.
He described how a party had been organised for children aged between seven and 14 where they had a Christmas dinner, played games and watched films before they started going to bed at about 10.30pm.
Mr Wicks said the sleeping arrangements for the children and the supervising adults were mats placed on the floors of the main hall and a back room.
He described how Hill started off sleeping in the main room but moved to the back room in the early hours because he had been cold.
Mr Wicks said that also sleeping in the back room was site manager Nicola Andrews who witnessed Hill carrying out the sex act between 12 and 18 inches from a child's face.
He said: "At about 5.30am, Nicola Andrews woke up again and as she looked across the room she could see the defendant, he had now positioned himself between children M and B.
"B was under a quilt, fast asleep facing the defendant, his head was in line with the defendant's midriff.
"As she looked Mrs Andrews suddenly realised he was actually masturbating. She noticed the defendant's eyes were open and he was looking at the child.
"She watched that for more than five seconds then she coughed and moved in a charade of waking up. She looked again, the defendant had stopped, covered himself up and closed his eyes."
Mr Wicks also said that another staff member had earlier seen Hill making movements which she thought might have been him masturbating.
He said that Mrs Andrews then asked Hill to join her in another room and asked him to leave the premises, which he did.
Mr Wicks said that he denied the incident and sent Mrs Andrews a text message saying: "I can't believe what's happening, I do not know what you think you saw but I swear I have done nothing wrong."
The police were alerted and when interviewed Hill denied the allegation and said that he was "upset and angry" over it.
He also said that he was not sexually interested in children and was attracted to women of his own age.