A teenage asylum seeker packed a bomb with screwdrivers, knives and nails to cause "maximum carnage" on a rush hour Tube at Parsons Green, a court heard.
Commuters fled in "fear and panic" when the carriage containing 93 people was engulfed by a "large fireball" at the west London station, jurors were told.
Iraqi Ahmed Hassan, 18, is accused of planting the homemade device containing 400g of explosives on the District Line carriage on September 15 last year.
The Old Bailey heard the passengers were "fortunate" because it only partially exploded.
Prosecutor Alison Morgan told jurors: "On Friday 15 September shortly before 8.20am an improvised explosive device partially detonated on a District Line Tube train very shortly after it had arrived into Parsons Green Station. It was a rush hour and the train was crowded.
"There were approximately 93 people in the carriage when the device detonated. The partial explosion created a large fireball.
"Some in the carriage were caught by the flames and sustained significant burns.
"Many ran in fear and panic. They were fortunate . Had the device fully detonated, it is inevitable that serious injury and significant damage would have been caused within the carriage.
"Those in close proximity to the device may well have been killed."
The jury was shown CCTV footage of the explosion from inside the Tube.
It showed a fireball engulfing the carriage, as people ducked from the flames.
The court heard how hundreds of people tried to get down the narrow staircase and out of the station following the explosion.
But Hassan had got off the carriage at Putney Bridge Station before the bomb went off on a timer, the court heard.
Ms Morgan said the device was made from the volatile chemical explosive TATP and contained a large amount of shrapnel to cause "maximum harm and carnage".
The 2.2kg of sockets, screws, bolts, nails, knives and screwdrivers had been put inside a white bucket, and an improvised initiator and explosives placed inside a Lidl bag.
Hassan arrived in Britain in the back of a lorry via the Channel Tunnel in October 2015.
He had no identity documents and claimed asylum, saying he was born in June 1999.
From 2016, he was living with foster parents in Sunbury, Surrey.
Hassan denies attempted murder and using the chemical compound TATP to cause an explosion that was likely to endanger life on September 15 last year.