Kimani Martin was shot last June in Tividale in revenge for abducting someone earlier in the evening, Birmingham Crown Court heard.
Kisharne Campbell, aged 23, and Usman Amjad, 22, both of no fixed address, along with Luke Adams, 20, from Walsall, and Atif Khan, 25, from, Tipton, all deny the charge of murder.
Prosecuting Edward Brown said: "In the early hours of June 20, 2021, the deceased Kimani Martin was travelling in a taxi with two companions. He was in the rear passenger seat, sitting behind the driver.
"In a space of a few minutes, he was targeted, found and shot dead.
"The fact that he was targeted did not come out of the blue. Whilst the reasons for his killing will go back a little in time, it was shortly before 1.30am when the taxi he was in was on Dudley Road East. A car behind it started flashing its lights.
"That car was a stolen blue Golf. Kimani Martin and his two companions in the taxi were clearly worried as to who it was in the car behind as it stalked them. For reasons that will become clear, they knew something of why they were being followed."
He added: "They told the driver to speed up. The taxi driver then heard a loud bang and he slowed down – he thought he had a burst tyre. The Golf then pulled up alongside the taxi, a loaded shotgun was pointed at the occupants of the taxi and it was fired directly into the taxi."
Kimani, from Birmingham, was shot in the head and died as a result of his injuries whilst his two friends ran off to nearby streets to safety.
Mr Edwards added: "The evidence will be that the gun that killed him was fired from less than approximately three metres from Kimani who was sitting behind the driver on the driver’s side.
"It may be that one or more of the two ‘sides’ was abducted and robbed – over quite what, no one directly involved has said, but it was plainly regarded as serious and ultimately resulted in the decision to shoot and kill Kimani Martin in retribution for what had happened that night."
Mr Edwards explained there were witnesses who saw the Golf chasing the taxi, drawing close, a shot was fired and then the Golf circled the taxi hoping to find the other two occupants.
The trial continues.