A man accused of plying a schoolboy with drugs and sexually assaulting him thought he was 19, the High Court was told on Friday.
The 13-year-old youth spent 16 hours unconscious in hospital after collapsing outside at the defendant's flat in north Belfast, a judge was told.
Counsel for the 43-year-old man claimed the incident on December 30 may have been a "drink-fuelled misunderstanding".
He was refused bail, however, due to the risk of potential re-offending.
The defendant is not being named to protect the boy's identity.
He denies sexual assault, being concerned in the supply of drugs, inciting the child to engage in sexual activity and administering cannabis and diazepam with the intention of stupefying him for sexual activity.
Police were alerted when the alleged victim told his father he had been given alcohol, drugs and sexually assaulted.
His friends claimed he went missing for three hours after being offered some 'green' - cannabis - and going back to the defendant's apartment.
Crown lawyer Mark Farrell said they went to look for him at the address, where he emerged in a completely intoxicated state.
"The injured party says he remembers going down the stairs and collapsing outside the block of flats," counsel said.
He was carried home by his friends, but had to be taken to hospital in an unresponsive state, according to the prosecution.
When the boy came round he claimed the defendant had invited him back for a smoke when they met at a nearby fast food restaurant.
Back at the flat the man provided him with cigarettes, a joint, a quantity of 'blues' and tried to kiss him, it was alleged.
Opposing bail, Mr Farrell submitted: "Police say this was an opportunistic attack on a young boy."
During police interviews the defendant accepted inviting the injured party back to his flat for drinks, but denied offering any drugs.
He also rejected allegations that he tried to kiss the youth, insisting that he was not into boys.
Defence barrister Jonpaul Shields told the court: "He said he thought the boy in his flat was older, about 19."
Describing his client as an alcoholic, Mr Shields argued that the alleged sexual motivation could be wrong.
"It may be absent in this case, and this may have been simply a drink-fuelled misunderstanding," he said.
But denying bail, Mr Justice Humphreys ruled: "I'm not satisfied that the risk of re-offending and interference with the injured party can be properly managed."