A teenager who planned to behead a British soldier has been jailed for 22 years by a judge at the Old Bailey.
Brusthom Ziamani, 19, from Camberwell, south London, was found guilty last month of preparing an act of terrorism.
The court heard he was inspired by the murder of Fusilier Lee Rigby and used the internet to research cadet bases.
He converted to Islam in 2014 and became radicalised. Months later he was arrested in east London in a possession of a 12in knife and a hammer.
Ziamani, who was 18 when held on the street in August last year as part of a joint police and MI5 intelligence operation, also had a black "Islamic flag" in his bag.
Police say he visited his former girlfriend earlier that day, when he showed her his weapons and told her he intended to attack and kill soldiers.
'Would have killed'
The trial heard he told her Michael Adebolajo - one of the men who murdered Fusilier Rigby in Woolwich, south-east London a year earlier - was a "legend".
In his sentencing remarks, Judge Timothy Pontius told Ziamani: "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."
He said Ziamani would have to serve at least two-thirds of his sentence before being eligible for parole, adding that he would extend the time he would spend on licence after his release by five years.
Ziamani was born in London to Congolese parents and went to school in Peckham. His mother worked as a nursery nurse and his father was a psychiatric nurse.
The defendant told the court that his parents, who are Jehovah's Witnesses, had found out he was a Muslim only when they had seen pictures of friends in Islamic clothes on his mobile phone.
'Groomed and radicalised'
During the trial, jurors heard how Ziamani had fallen in with members of the extremist organisation al-Muhajiroun, after he was "kicked out" of his home after converting to Islam.
Police say the group played a "major role in influencing and shaping his radical views" and he attended their demonstrations.
The jury heard Mr Ziamani also put posts on Facebook supporting Sharia law and stating he was "willing to die in the cause of Allah".
It was told Ziamani had been arrested in June last year on an unrelated matter and police found a ripped-up letter to his parents in his jeans pocket, in which he had written about mounting an attack on a British soldier.
In the letter Ziamani stated because he had no means of getting out to Iraq or Syria he would wage war against the British government on UK soil.
He was bailed, but refused to engage with officers from the government's anti-radicalisation programme, Prevent.
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.
"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," he said.
"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."
When Ziamani was convicted last month, Commander Richard Walton of the Counter Terrorism Command described him as an "impressionable young man who became radicalised then rapidly developed an extremist, violent mindset".
After the sentencing, Deb Walsh, deputy head of counter terrorism at the Crown Prosecution Service, said: "This case highlights how violent and extreme views on a page can become credible threats to the lives and safety of British citizens."