A teenager has been jailed for 22 years for hatching a plot to behead a British soldier inspired by the murder of Fusilier Lee Rigby.

Brusthom Ziamani, 19, was arrested in an east London street carrying a 12in (30.5cm) knife and a hammer in a rucksack, having earlier researched the location of Army cadet bases in the south east London.

Earlier, he had shown his ex-girlfriend weapons, described Fusilier Rigby's killer Michael Adebolajo as a "legend" and told her he would "kill soldiers".

The court heard he was a "lone wolf" who had been radicalised after being befriended by members of a radical Muslim organisation which held meetings and demonstrations in London.

He was found guilty of preparing an act of terrorism on or around August 20 last year following a trial at the Old Bailey.

Sentencing him, Judge Timothy Pontius said: "A realistic and sensible assessment of the whole of the evidence leads inescapably to the conclusion that this defendant, had he not by sheer good fortune been spotted and stopped by the police on the street in east London, would have carried out the intention he had so graphically expressed to his ex-girlfriend just a few hours before."

The judge told Ziamani that he would have to serve at least two-thirds of his 22-year sentence before being eligible for parole, adding that he would extend the time he would spend on licence after his release by five years.

Earlier, in mitigation, Ziamani's lawyer, Naeem Mian, said his client was not an "entrenched extremist" but a young man who while destitute had been groomed by people who were "more sophisticated and mature" than him.

He said: "It is worrying to say the least that those who groomed him are able to groom and radicalise a young man in such a short period of time.

"On any view it is a tragic case because this young man will spend a long time in custody after which he will inevitably be unemployable. His foolish, naive acts have resulted in him throwing his life away at his tender age.

"He has nothing to look forward to now. The only glimmer of hope he has is the fact his parents - in particular his mother - has been to see him a number of times since his conviction. They are still not comfortable with the fact he has converted to Islam. As you would expect of caring and loving parents, they have been to see him."