The "tragic" death of a 16-year-old boy followed the "bad decision" to get drugs before a rave, a court has heard.
Daniel Spargo-Mabbs died as a result of taking ecstasy at the rave in Hayes in west London earlier this year, Tyrone Silcott, prosecuting, told Isleworth Crown Court.
Ryan Kirk, 21, from Beckenham, South London, is on trial charged with being concerned in supplying a controlled drug of class A - MDMA - on January 17 this year. He is also charged with being concerned in supplying class A and class B drugs between January 1 2013 and January 16 2014.
He denies the charges against him.
Opening the prosecution's case, Mr Silcott said: "Back on the 17th of January of this year a group of young men aged between 15 and 17 were going out for an evening to a party sometimes known as a rave at a venue in Hayes.
"The group of young men made a bad decision that evening."
He told the jury a phone call was made and ecstasy was requested, adding: "One of those young men died as a result of taking ecstasy."
The court heard "three bags of white powder" were delivered before the rave. The jury was told Daniel paid £20 towards a quantity of MDMA and put what was thought to be half a gram of the drug into 500mls of water in a bottle - with one witness claiming he possibly drank it all in one go.
Mr Silcott told the jury that "despite the tragic backdrop" of the case, their focus should be on whether or not Kirk was the person who delivered the drugs on January 17.
The jury was told that another man, Nicqueel Pitrora, 18, from Croydon, pleaded guilty at the same court yesterday of being concerned in supplying a controlled drug of class A on January 17.
Mr Silcott said it was Pitrora who was telephoned and asked if he could supply two and a half grams of MDMA.
The group was quoted a price of £80, the court heard.
Mr Silcott said witnesses described the person who delivered the drugs as being a white man with pale skin and of skinny build. "The prosecution say it was Ryan Kirk," Mr Silcott said.
One witness, who cannot be named for legal reasons, said today he was 80% sure that the person he picked out during an identity parade was the person who delivered the drugs.
The jury was shown footage of the identity parade and when the identity officer asked if the witness has made a positive identification, he says: "Yes. Do I have to be certain? If I have to be certain, then no."
The court heard that Kirk claims to have been at his friend's house playing X Box on the night he is accused of delivering the drugs. "He said he does not attend raves and has never been to Hayes," Mr Silcott said.
The court heard Daniel took off his shirt after taking the drugs and was "talking a lot more than he usually does", including talking about his girlfriend.
Mr Silcott said a toxicology report found that after the incident Daniel had MDMA in his blood.
The trial continues.