A man shot dead in a car in north-east London was killed "by mistake" in a "ruthless" attack as part of a turf war by rival youths, the Old Bailey heard.
Joseph Williams-Torres, 20, was shot as he sat in a stationary vehicle in Walthamstow on 14 March 2018.
He died on his way to the hospital less than an hour later.
Hamza Ul Haq, 21, of Manor Park, Loic Nengese, 19, of Walthamstow and a 16-year-old, who cannot be identified for legal reasons, all deny murder.
The court heard Mr Williams-Torres was targeted by three hooded youths as he sat with a friend.
His attackers saw him, then pulled out a gun and fired - hitting him in the chest and legs - before running off in less than two minutes, the Old Bailey was told.
Prosecutor Allison Hunter QC said it was "clearly a targeted attack", but the "baffling question" was "why".
She said the answer lay in that the shooting was part of a series of related and "retaliatory" acts of violence that had its roots in a dispute between rival groups of youths.
Ms Hunter said the defendants were friends who were associated with a group known as the Mali Boys.
She said the Mali Boys had become increasingly confrontational and angry since the murder of one of their own in May 2017.
The intended target, she said, was the same height and build and even wore the same beanie hat as Mr Williams-Torres, who lived locally.
"Joseph Williams-Torres was murdered by mistake," Ms Hunter told the court.
"It was undoubtedly a ruthless and planned attack on a rival group member, but he was not the intended target.
"They had, it would appear, mistakenly identified him for another."
The trial continues.