A five-year-old girl was "happily playing" in a shop when she was hit by gang gunfire and left permanently paralysed, a court heard on Monday.
Thusha Kamaleswaran died twice as medics battled to save her life following the shooting at Stockwell Food and Wine in south London in March last year.
Three men with their faces partially covered "circled" on bikes outside the shop, before one opened fire with a handgun.
They were searching for rival gang members but hit "two completely innocent bystanders", prosecutor Edward Brown QC said.
A bullet passed through Thusha's body and an emergency team had to carry out "invasive surgery" at the scene to restart her heart, jurors at the Old Bailey heard.
The little girl went into cardiac arrest for a second time at King's College Hospital but was again saved by emergency surgery.
However, her injuries caused paralysis and she will never walk again.
A 35-year-old shopper was also hit during the shooting and has bullet fragments permanently lodged in his head.
Had the wound been centimetres to one side he would have died, jurors were told.
Kazeem Kolawole, 19, Anthony McCalla, 19, and Nathaniel Grant, 21, deny causing grievous bodily harm with intent to Thusha and the shopper Roshan Selvakumar.
Opening the prosecution case, Brown said that Thusha and Selvakumar were "remarkably lucky" to survive.
The three defendants are accused of acting together in staging the attack.
They also face charges of the attempted murder of another man, Roshaun Bryan, who the prosecution say was the intended victim that day, and possession of a firearm with intent to endanger life.
Brown told the jury that the shooting bore "all the hallmarks" of gang rivalry, animosity that "on occasion leads to needless but very serious violence".
He went on: "The immediate legacy of that gang violence lies in Thusha's permanent disability and the bullet that remains in Mr Selvakumar's neck."
The three defendants are accused of being part of the GAS or OC gang, based in Brixton, which has an ongoing rivalry with another gang called ABM.
They were on a "mission" to find a rival gang member on the day of the shooting, jurors were told.
Brown said: "The three were beyond doubt working as a team, each with a shared intention, one encouraging the other.
"The reality of this shooting may be that, whilst there was an intention to kill the suspected rival gang member, the gunman and his accomplices couldn't have cared less if someone else was shot too."
Thusha, whose uncle owns the shop, was playing with her two siblings just before the shooting shortly after 9pm on March 29 last year.
Brown said the gun was fired at least twice, and that the gunman would have been able to see Thusha when he fired the second shot.
"At the moment of the second gunshot, she was in an aisle, and in fact must have been in the sight of the gunman and in the sight of perhaps the others," he told the court.
Selvakumar, who lived in a flat above the store, was chatting to shop workers at the time.
It is alleged that Grant was the gunman, and that Kolawole and McCalla acted as a team with him, the court heard.
It is claimed that a test shooting was carried out around 40 minutes before the attack to make sure the gun was working.
A man was seen on a green in Hammelton Green, south west London, firing a gun into the air three times.
The jury was also shown a number of short CCTV clips showing three men that it is claimed are the defendants in the lead-up to the shooting.
Kolawole, of Black Prince Road, Kennington, south east London; McCalla, of Oakdale Road, Streatham, south London; and Grant, of Camberwell New Road, Camberwell, south east London, deny all the charges.
The trial was adjourned until tomorrow.