A white supremacist terrorist who stabbed a grandfather to death and bombed mosques in an effort to trigger a racial war on Britain's streets has been jailed for life.

Ukrainian student Pavlo Lapshyn, 25, was told he would not even be considered for release until his minimum tariff of 40 years was served. The judge did not impose a whole-life sentence, which the prosecution had requested.

Mr Justice Sweeney said Lapshyn went to Small Heath, Birmingham, "intent on finding a Muslim to murder" after arriving in Britain to further his studies.

The judge said to Lapshyn that he was not sure he had "murdered to further a cause as such", but "[you were] acting alone, being motivated by your own extreme and appalling prejudices".

Lapshyn found Mohammed Saleem, 82, going home after praying at his local mosque. The student approached him from behind and plunged a hunting knife into him three times with such force that one wound went through to his front.

Lapshyn's campaign began in April 2013, just five days after his arrival from Ukraine, where he had won a prize to gain work experience in Britain. When the PhD student was arrested in July, police found three partially assembled bombs in his Birmingham flat.

After Saleem's murder, Lapshyn started placing homemade explosives outside mosques on Fridays, the main day of Muslim prayer.

The device he planted in July, which had 100 nails wrapped around it to maximise the carnage, was aimed at worshippers at the Tipton mosque, where 300 were people were expected to attend prayers.

Prayers that particular Friday were held an hour later, thus avoiding mass casualties. The device was so powerful it left nails embedded in tree trunks, police said.

Devices had also been placed outside mosques in Walsall and Wolverhampton.

The court heard that pictures and video were recovered from Lapshyn which showed him experimenting with bombs in the Ukrainian countryside before he came to Britain. He had also researched where he could get materials from in Birmingham to make improvised explosive devices.

Lapshyn is one of only a few terrorists in the modern British era to stage an attack, kill someone and survive to face court.

After sentencing, Louise Gray, a lawyer for the Crown Prosecution Service counter-terrorism division, said: "Pavlo Lapshyn is a dangerous man with a dangerous agenda. Just a day after his arrival in Britain from the Ukraine he was researching rightwing supremacist websites, including those linked to convicted racist murderers in Russia."

She added: "This case is a clear reminder of the link between extremist material and the very real threat to life posed by those who access it. It is also a reminder that the threat of terrorism comes from a very wide spectrum of hateful views.

"I am pleased that, because of the strength of our case, Pavlo Lapshyn pleaded guilty, sparing [Mr Saleem's] family from having to sit through a trial. I extend my sincere condolences to them and hope that today's sentencing will provide some small comfort."

Assistant Chief Constable Marcus Beale, the head of the West Midlands police counter-terrorism unit, said Lapshyn had shown no remorse or regret. He said it would be unwise to comment on Lapshyn avoiding a whole life sentence and described the 40-year term as extremely lengthy.

Lapshyn bowed his head as he was taken down to the cells after listening to the judge's remarks impassively.