Iraqi Ahmed Hassan (pictured), 18, is accused of building a deadly explosive device, packed with 5lbs of knives, screwdrivers and nails to inflict 'maximum carnage' on a District Line Tube train at Parsons Green, London on September 15 last year

A teenage asylum seeker set off a bomb on the Tube after coming to Britain in the back of a lorry and telling the Home Office he was trained to kill by Islamic State, a court heard yesterday.

Iraqi Ahmed Hassan, 18, is accused of building a deadly explosive device, packed with 5lbs of knives, screwdrivers and nails for 'maximum carnage', at the foster home where he was given refuge.

The bomb contained 14oz of the explosive TATP, commonly known as 'Mother of Satan', and sent a fireball through a District Line carriage packed with rush-hour commuters – injuring 30 – at Parsons Green station in West London on September 15 last year.

The Old Bailey heard that it was a 'matter of luck' the bomb did not fully detonate and no-one was killed. Jurors were also told that:

Hassan sneaked into Britain through the Channel Tunnel aged 15

He openly declared his links to IS when he applied to the Home Office for asylum

The teenager was allegedly seen by staff at a charity-run shelter looking at an IS video and listening to jihadi songs, yet no-one raised the alarm;

While his foster parents were on holiday, Hassan ordered bomb ingredients on Amazon using a £20 gift voucher he won after being named 'student of the year';

He loaded his bucket bomb with shrapnel, including screwdrivers and drill bits bought from Asda and Aldi.

Hassan is captured on CCTV collecting chemicals to make his 'Mother of Satan' bomb

The alleged bomber openly declared his links to IS when he applied for asylum after arriving in Britain as a lone child refugee, the court was told.

In his first interview with immigration officials on January 18, 2016, Hassan said he had been trained to kill by jihadis with 1,000 other people, adding: 'They trained us on how to kill. It was all religious-based.'

But he claimed he went along with it only because he feared the fanatics could kill his family, and said he was claiming asylum in Britain because he was 'in fear of Islamic State', the court heard.

Prosecutor Alison Morgan described what Hassan – who had no identity documents to verify his name or age – said to immigration officials.

She said: 'He was forced to go on his own otherwise they would kill his family and he shared training with 1,000 people and they would spend three to four hours a day in the mosque.'

The bomb (pictured) contained 14oz of the explosive TATP, commonly known as 'Mother of Satan', and sent a fireball through a District Line carriage packed with rush-hour commuters – injuring 30 – at Parsons Green station in West London on September 15 last year

Ahmed Hassan being given a 'Student of the Year' award at Brooklands College. He used the £20 Amazon token prize to buy hydrogen peroxide for the Parsons Green bomb, the Old Bailey heard

The 15-year-old denied being a sleeper IS fighter sent to Europe and claimed he fled to Britain after being freed by Iraqi soldiers.

But shortly after his arrival in the UK, Hassan was seen by staff at a shelter in Horley, Surrey, run by children's charity Barnados secretly watching a video featuring masked men with machine guns bearing an IS flag, it was said.

He was also allegedly caught listening to a 'call to arms' song, with the lyrics: 'We are coming with you to the slaughter in your home and country.'

Despite this worrying behaviour, the teenager was referred by social services to Brooklands College, where he was given a mentor who helped him find a foster home in Sunbury, Surrey.

At the college, where he studied media, the jury heard the teenager made a film as part of his course showing a mobile phone being destroyed, in an apparent rehearsal of his efforts to hide his tracks following the bombing.

He also kept on a memory stick a series of disturbing songs known as 'nasheeds' encouraging 'violent military action' in support of IS, it was said.

Barely 18 months after his admission to the Home Office, Hassan shopped for bomb ingredients on Amazon, and at Aldi and Asda, jurors heard.

He allegedly ordered a five-litre bottle of hydrogen peroxide and sulphuric acid from Amazon in August before assembling the bomb while his foster parents were on holiday for a week.

The day before the Parsons Green bombing, Hassan was caught on CCTV in an Asda supermarket shopping for batteries and a screwdriver set before buying drill bits from an Aldi store to add to the bomb, the court was told.

On September 15, Hassan allegedly carried his bomb in a bucket hidden in an Aldi shopping bag through Wimbledon station, calmly walking past school children and commuters.

The Old Bailey heard the teenager loaded his bucket bomb with shrapnel, including screwdrivers and drill bits bought from Asda and Aldi. Pictured: acid Hassan bought

In a toilet on the concourse, Hassan set the modified kitchen timer on the device before boarding the train, the jury heard.

He got off at Putney Bridge station, two minutes before the bomb went off at just before 8.20am – shortly after the train arrived at Parsons Green, the court heard.

The bomb caused a stampede as hundreds rushed to get out of the station.

Miss Morgan said: 'It was 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.

'It was a matter of luck that the device did not function as intended... The defendant intended to kill people.'

Victims: One of the 30 injured in the Parsons Green Tube attack on a District Line train last year

She added: 'He never intended to be injured by the device himself. Instead he had created a timer system to ensure that it detonated in his absence.'

Hassan, wearing a navy jumper, stared at the ground as the jury were shown the chilling footage of commuters standing shoulder-to-shoulder in a packed train sipping from coffee flasks and reading newspapers, when the carriage was suddenly engulfed in a wall of flame.

Hassan was captured on CCTV walking away from Putney Bridge station without a backward glance, before boarding a bus travelling past his target to see the carnage unfold, Miss Morgan said.

When the bus drove past Parsons Green station, he glanced out of the window before coolly removing the memory card from his mobile phone, chewing it and stuffing it down the side of the seat, she said.

In a bid to avoid detection, Hassan changed his clothes several times and bought a new mobile phone to check BBC News coverage of the blast as he took a series of trains to Richmond, Brighton and finally Ashford in Kent.

He was arrested the next day at 7.52am at the Port of Dover. He was carrying £2,320 in cash, it was said.

The court heard that the defendant's asylum claim was unresolved at the time of his arrest.

Hassan, from Sunbury, denies attempted murder and causing an explosion likely to endanger life or damage property.

The trial continues.