Media playback is unsupported on your device Media caption Brusthom Ziamani "told police he wanted to die as a martyr and go to paradise", as the BBC's June Kelly reports

A teenager was arrested as he made his way to behead a British soldier, the Old Bailey has heard.

Brusthom Ziamani, 19, had a rucksack containing a 12in knife, a hammer and an "Islamic flag" when he was held on a street in east London in August 2014.

He idolised the killers of Fusilier Lee Rigby, researched Army cadet base sites and told an ex-girlfriend of a plan to "kill soldiers", the court was told.

Mr Ziamani, of Camberwell, London, denies preparing an act of terrorism.

Jurors heard Mr Ziamani had converted to Islam in early 2014 and his arrest came after he had shown the former girlfriend the weapons and described Fusilier Rigby's killer Michael Adebolajo as a "legend".

Prosecutor Annabel Darlow told the court: "He didn't say anything when he was arrested but 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.

"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."

The jury heard Mr Ziamani also put posts on Facebook under the name Mujahid Karim, supporting Sharia law and stating he was "willing to die in the cause of Allah".

Mr Ziamani is charged with preparing an act of terrorism on or before 20 August 2014.

'Changed person'

Mr Ziamani had previously been arrested in June 2014, the court heard.

The court was told that on 20 June he had searched the internet for "Camberwell Army cadets" and for cadets in Lewisham.

Jurors also heard he had looked at the website of the London Irish Rifles Association and found details of the Army Cadet Force in Blackheath.

After this arrest police found a letter in his jeans addressed to his "beloved parents" saying he was a "changed person".

Image copyright PA Image caption Fusilier Lee Rigby was murdered in Woolwich, south-east London, in May 2013

He wrote of being martyred and going to paradise and referenced people being raped, tortured and killed in Iraq and Syria, saying 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.

"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."

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 engagement officers from the anti-radicalisation Prevent programme.

The court heard Mr Ziamani was unresponsive and said he "did not need help with his religion" and had left the home of his Christian family.

Mr Ziamani continued to post extremist material on Facebook, including a photo of six severed heads, the court head.

'Statements to girlfriend'

The jury, of eight women and four men, also heard he researched the murder of Fusilier Rigby, reading news articles about the attack and Adebolajo.

The prosecution said Mr Ziamani identified with Adebolajo, as he was also a convert from a Christian family.

His arrest on 19 August 2014 came three days after he got back in touch with his former girlfriend.

Giving evidence from behind a screen, the former girlfriend told the court Mr Ziamani had turned up at her home several times and showed her the hammer and knife wrapped in the flag.

She said: "I asked why he had these and he said 'me and the brothers are planning a terrorist attack'. I said what, like a bomb or something and he said 'no, a soldier or a member of government."'

The jury was told their relationship had ended after he converted to Islam and began wearing Islamic clothing.

"He said things like when the Lee Rigby murder happened, he respected the people that had done it," she told the court.

Cross examined by defence barrister Naeem Mian, she agreed with the suggestion that Mr Ziamani was someone who sometimes "made things up".

She added she did not call police after Mr Ziamani left her home, telling them about what he had said when officers turned up after the arrest.