Bystanders fought to disarm a man who stabbed a former friend in a shop before continuing the attack in the street, a court heard.
Esam Dawood, 27, of Barton Street, Gloucester, is accused of stabbing Omar Rashid, 35, on 26 August 2019. He died in hospital on 12 September.
The jury heard a man who intervened was stabbed in the arm by Mr Dawood, before another wrestled the knife from him.
Mr Dawood denies murder at Gloucester Crown Court.
He also denies inflicting grievous bodily harm with intent on another man, Uche Chikwendu.
Andrew Langdon QC told the jury Mr Dawood and Mr Rashid had arrived in the UK from Sudan and had been friends for some time before falling out.
Mr Dawood came into Barton Best Foods and headed straight for Mr Rashid.
He pulled out "a large kitchen knife" and stabbed him "in the back, repeating the action," Mr Langdon said.
The alleged attack continued in the street where Mr Chikwendu, a shopkeeper, tried to disarm Mr Dawood, but was stabbed in the arm.
Another witness, Gabriel Harsul, described seeing Mr Rashid "stumbling on all fours dripping with blood, followed by an Asian man brandishing a large knife".
Faisel Saliah told the court he chased Mr Dawood outside the shop and saw him "stabbing Mr Rashid numerous times".
Mr Langdon said Mr Dawood went back to his flat directly opposite the shop, changed clothes and made some phone calls.
Armed police later arrested him and discovered clothes he had been wearing that were wrapped in a plastic bag.
Blood from the clothes and footprints leading to his flat had matched the blood on a knife found from the scene, the court heard.
The trial continues.