A teenager who idolised the killers of Lee Rigby was arrested as he made his way to behead a British soldier, a court heard.
Brustchom Ziamani, 19, was arrested on a street in east London in August carrying a 12-inch knife and a hammer in a rucksack, having earlier researched the location of army cadet bases, the Old Bailey heard.
Ziamani had "reverted" to Islam early in 2014 and his August arrest came after he showed his ex-girlfriend the weapons, described Lee Rigby's killer Michael Adebolajo as a "legend" and told her he would "kill soldiers", prosecutor Annabel Darlow said.
Brustchom Ziamani, seen in a sketch from an earlier court appearance
The jury heard he also posted on Facebook under the name Mujahid Karim supporting Sharia law and stating he was "willing to die in the cause of Allah".
Ms Darlow said: "He was remanded and told a security officer that he had been on his way to kill a British soldier at an army barracks when he had been arrested.
"He said that he was going to behead the soldier and hold that soldier's head up in the air so that a friend could take a photograph with the severed head of the soldier.
"You may think that his aim was to emulate the dubious feats of his hero Michael Adebolajo, who had murdered a British soldier close to the Woolwich barracks where he worked."
Ziamani, of Camberwell, London, denies a charge of preparing an act of terrorism on or before August 20 last year.
Ziamani had previously been arrested in June 2014, the court heard.
The court heard on June 20 he had googled "Camberwell army cadets" and looked at the website of the London Irish Rifles Association, and for cadets in Lewisham, looking at details of the Army Cadet Force in Blackheath.
Ms Darlow added: "These were all military targets which would reflect the defendant's stated intention to wage war on the British Government and to further his ambition of carrying out attacks like those on Lee Rigby in Woolwich."
After his June arrest police found a letter in his jeans addressed to his "beloved parents" saying he was a "changed person".
He wrote of being martyred and going to paradise and referenced people being raped, tortured and killed in Iraq and Syria, saying that he had a "duty" to help them.
He wrote: "Because I have no means ov gettin there I will wage war against the british government on this soil the british government will have a taste of there own medicine they will be humiliated this is ISIB Islamic State of Ireland and Britain (all sic)."
He added: "Now we will take a thousand ov yours then ten thousand and send you all to the hell-fire you want war you got it British soldiers heads will be removed and burned u cannot defeat the Muslims we love to die the way you love to live my fellow muslim brothers these people want war lets kill them slaughter them and implement sharia in our lands and UK (all sic)."
He went on: "Lee Rigby is burnin in hell im dying good for him this is what you get for voting Cameron and democracy."
He told police he looked up to radical preachers including Abu Hamza and Anjem Choudary, but denied he was planning an attack.
He was later released on bail and spoken to in July by anti-radicalisation Prevent Engagement Officers. The court heard Ziamani was unresponsive and said he "did not need help with his religion" and had left the home of his Christian family.
Ziamani continued to post extremist material on Facebook, including a photo of six severed heads, the court head. He also wrote about waging war on the "kuffar" and "it is a shame Hitler never finished his job".
He also wrote: "You can sit at home and play Call of Duty or you can come out here and respond to the real call of duty - the choice is yours."
The court heard he also researched the murder of Lee Rigby, reading news articles about the attack and Adebolajo.
Lee Rigby's killers: Michael Adebolajo (left) and Michael Adebowale (right)
Ms Darlow added: "The prosecution say that the defendant saw Michael Adebolajo as a hero and role model whose crimes he aspired to copy."
Ziamani identified with the Woolwich killer, she added, as he was also a convert from a Christian family and took direct action against the armed forces.
Ziamani got back in touch with his ex-girlfriend, on August 16. The court heard he sent her messages and made several visits over the next few days, telling her: "If I leave this world I don't want any hatred to be left between us."
On August 19 he arrived at her home at 7am, telling her: "Me and the brothers are planning a terrorist attack," Ms Darlow said.
The teenager asked Ziamani if he meant a bomb and he said: "No not like that, basically to kill soldiers."