The teenage asylum seeker behind September's failed London Underground bombing told British authorities he was trained "to kill" by Islamic State (IS), a court heard.
Iraqi Ahmed Hassan, 18, is accused of packing shrapnel into a plastic bucket containing 400g of explosives then leaving it to go off on a timer at Parsons Green station during rush hour on September 15.
There were 93 commuters on board when the District Line carriage turned into a "furnace engulfed in flames", leaving many with serious burns or crushed in the stampede.
Prosecutor Alison Morgan told jurors it was just "a matter of luck" that the bomb did not fully detonate and people were not killed.
Hassan had arrived in Britain in the back of a lorry via the Channel Tunnel in October 2015.
In January 2016, he claimed asylum, saying he was in "fear of Islamic State" because of what happened to him in his home country.
Asked by Home Office officials if he ever had any training with IS, he said: "They trained us on how to kill. It was all religious-based."
He said he was recruited on his own and trained with 1000 people until Iraqi soldiers came into IS territory and told everyone to go.
He denied he had been sent to Europe to work for IS, the court heard.
In early September 2017, Hassan allegedly seized a "window of opportunity" to prepare the device while his foster parents were on holiday in Blackpool.
To distract attention from himself, he got the hydrogen peroxide delivered to a friend's address, jurors were told.
The court heard Hassan had packed the bomb with 2.2kg of screwdrivers, knives and nails to cause "maximum carnage".
© PAA 2018