A 15-year-old British boy who plotted to behead police officers at an Anzac Day parade in Australia has been sentenced to life imprisonment.
The Blackburn teenager will serve at least five years for inciting terrorism and will only be released once he is no longer considered to be dangerous.
He sent thousands of online messages to an alleged Australian jihadist and was planning "a massacre", the court heard.
He is believed to be the youngest Briton guilty of a terror offence.
Police said the plan hatched by the boy - who was aged 14 at the time and will remain anonymous due to his age - was "shocking in its brutality and scope".
The boy remains a "significant risk", the judge, Mr Justice Saunders, said.
Dominic Casciani, BBC home affairs correspondent, said the five-year minimum term was a "window of opportunity" to see if the boy can be deradicalised before he is then moved into the adult prison system.
But a BBC correspondent said he may potentially never leave custody.
The court heard how the boy adopted an older persona in his messages to alleged Australian jihadist Sevdet Besim, 18, in which he instructed him to carry out an Islamic State terror group inspired attack.
They had been put in touch by a well-known Islamic State recruiter, Abu Khaled al-Cambodi - also an Australian.
The plot, hatched from the bedroom of the Lancashire teenager's suburban home earlier this year, was for Mr Besim to run over at least one police officer and then behead them with a knife at the remembrance parade in Melbourne, Manchester Crown Court heard.
Anzac Day, held on 25 April each year, commemorates Australian and New Zealand personnel killed in conflicts - and this year marked the centenary of the World War One battle in Gallipoli.
In one exchange of messages, the teenager suggested Mr Besim get his "first taste of beheading" by
attacking "a proper lonely person".
The pair would "in all probability" have succeeded had British police not accessed material on the boy's phone and alerted Australian police, the court had heard.
The boy later told his psychiatrist it would be a "massacre".
Mr Besim is awaiting trial in Australia next year.
Wearing glasses and grey trousers and shirt, the boy sat impassively as his sentence was read out, before hugging his tearful parents and family members in turn, and being led away.
Sentencing the teenager, judge Mr Justice Saunders said the youth would have "welcomed the notoriety" had the plot succeeded.
He said it was "chilling" that someone who was only 14-years-old at the time could have become "so radicalised that he was prepared to carry out this role intending and wishing that people should die".
He had been "immersed" in online extremist material and "groomed" by adult extremists who then started using him to carry out their wishes, the judge said.
Speaking outside court the boy's solicitor, Daniel King, said the family were "shocked and devastated" when he was arrested, as they had no idea about his intentions and were relieved that no one had been harmed.
The court previously heard the teenager had been referred to the authorities by his school on several occasions for threatening behaviour, including telling one teacher he would "cut his throat and watch him bleed to death". He had also cited Osama Bin Laden as his hero.
The youth had found an online jihadist community through his first smartphone which "filled a void" caused by problems he was having at school and at home as well as a degenerative eye condition.
Within two weeks of setting up a Twitter account he had 24,000 followers as he constructed a fantasy image of himself and "quickly became a celebrity" within the jihadi Twitter community.
He was referred to the government's de-radicalisation initiative Channel, but only paid "lip service" to attempts to reform him, Mr Justice Saunders said.
He said "no doubt lessons can and have been learnt" about how his case might have been handled.
But he stressed the blame lay entirely with "those extremists who were prepared to use the internet to encourage extreme views in a boy of 14 and then use him to carry out terrorist acts".
Detective Chief Superintendent Tony Mole, from the north west counter terrorism unit, said the boy had been known to police but had resisted intervention.
"That's a dangerous game to play because you can get people like us knocking on the door and investigating you, which is not the place we want to be dealing with 14-year-old people," he said.