LONDON (Reuters) - An Iraqi asylum-seeker was jailed for 34 years on Friday for trying to set off a homemade bomb on a rush-hour London commuter train in a botched attack that injured 30 people last year.

Slideshow ( 2 images )

Ahmed Hassan was found guilty last week of trying to murder passengers on an underground train heading to central London on Sept. 15. Police it was only luck that his device, packed with shrapnel, did not properly detonate.

At London’s Old Bailey Court, he was sentenced to life in prison and told he would spend at least 34 years behind bars.

“You were determined to create as much death and carnage that day as possible,” said the judge, Charles Haddon-Cave.

“I am satisfied that you were driven and motivated by four things: a mind-set of ISIS (Islamic State) extremism, a deep-seated hatred of this country, a desire for revenge against Britain and America whom you blamed for your father’s death in Iraq and anger at the continued bombing of Iraq by Western Coalition forces.”

The Iraqi, who the judge said was older than his given age of 18 but younger than 21, came to Britain illegally in 2015 and told officials he had spent three months in an ISIS training camp.

He was a model student, winning a prize for “student of the year” at his local college, but the judge said he harboured “dark thoughts” although only began researching his attack just a month before he carried it out.

On the day of the bombing, the teenager left his foster home in Sunbury-on-Thames, southwest of London, and headed for the local station with his bomb placed in a bucket and hidden in a supermarket shopping bag.

It was made with the highly volatile triacetone triperoxide (TATP) - known as “the mother of Satan” - and packed with more than 2 kg of metal shrapnel including screws, bolts, nails, knives and screwdrivers.

The device went off at Parsons Green station in Fulham, where flames engulfed the carriage with 93 people on board but because it did not fully explode, injuries were limited. Authorities said it was Britain’s fifth major attack of 2017.

He had got off at the previous stop and the following day was arrested in the southern port of Dover where he had been trying to flee abroad.

Hassan, who had denied the charges, admitted to police he had made the bomb but said he had never intended to kill and merely wanted attention.

“You should understand that the Koran is a book of peace; Islam is a religion of peace,” Haddon-Cave told him.

“You have violated the Koran and Islam by your actions, as well as the law of all civilized people. You will have plenty of time to study the Koran in prison in the years to come.”