An Uber driver attacked police with a Samurai sword outside Buckingham Palace out of "hatred" for the Queen, a court has heard.

Mohiussunnath Chowdhury, 27, shouted "Allahu Akbar" ("God is the greatest") as two officers grappled with him near the Queen's London home in August last year.

After he was arrested, a suicide note to his sister was found, the Old Bailey heard.

He allegedly wrote: "Tell everyone that I love them and that they should struggle against the enemies of Allah with their lives and their property.

"The Queen and her soldiers will all be in the hellfire they go to war with Muslims around the world and kill them without any mercy.

"They are the enemies that Allah tells us to fight."

The defendant, of Kirkwood Road, Luton, Bedfordshire, denies preparing acts of terrorism on August 25 last year, claiming he only wanted to get killed.

Opening his Old Bailey trial, prosecutor Tim Cray said: "Shortly before 8.30pm on Friday August 25, this defendant was in his motorcar just outside Buckingham Palace in central London.

"Coming down the other way was a marked police van coming from Charing Cross station.

"As the defendant got up to where the police van was coming towards him, he swerved his car through the traffic cones designed to keep the two lanes of traffic apart."

Two officers got out to investigate, initially thinking the driver was drunk or on drugs, the court heard.

Mr Cray said: "In fact, as the events in the next few minutes and the detailed investigation later were to prove, we say, this defendant had something far more serious in mind.

"It was down to the quick reactions of the police the defendant was stopped.

"As officers got out of the car, they heard the defendant say words to the effect 'It's all a bit f***** up'.

"They then saw him reach for something that turned out to be a sword.

"There was a short, desperate struggle with the officers trying to get the sword off the defendant while he is punching at them and they are punching at him.

"The defendant is shouting 'Allahu Akbar' over and over again so by now the police officers understandably believed they were dealing with a terrorist incident."

Pc Ian Midgley and Detective Sergeant Gavin Hutt suffered cuts as they disarmed the man, jurors were told.

Mr Cray said that, at 5.15pm that day, the defendant had sent a suicide note to his sister "expressing hate of the Queen and her soldiers" - including the police. 

The defendant was largely keeping his interest and support for terrorism by Islamic State away from his family, something he was doing online, largely by himself

He told jurors: "He was saying to his sister that he intended to get to paradise by becoming a martyr fighting 'the enemies of Allah'."

Half an hour before he sent the note, he bought a knife sharpener at Sainsbury's to hone the blade.

Mr Cray produced the 3ft (1m) long sword and held it up in court to show jurors.

He said the incident came six months after the murders at Westminster Bridge using a car and at the Houses of Parliament, and three months after the London Bridge attacks.

Chowdhury was born in London to a "close and supportive family" and worked as an Uber driver.

The prosecutor said: "The defendant was largely keeping his interest and support for terrorism by Islamic State away from his family, something he was doing online, largely by himself.

"This interest, this self-radicalisation is something we say he chose for himself."

The court heard he had watched the Channel 4 drama The State, about British citizens going to Syria, and recommended it to his family.

He had searched the internet for Isis beheadings and Jihadi John, jurors were told.

And he allegedly discussed the Westminster attacker Khalid Masood on WhatsApp, saying: "F*** the police."

On August 19 last year, the defendant allegedly sent emojis of a British soldier in red tunic and bearskin hat, a knife and an "Arabic figure" on WhatsApp.

On the day of the alleged attack, he changed his profile picture to a green bird, in reference to becoming a martyr, jurors heard.

A satnav error took the alleged terrorist to a pub called the Windsor Castle instead of one of the Queen's residences earlier on the day of his arrest.

Mr Cray said Chowdhury had left home at 6.30pm on August 25 last year and headed to Windsor.

He said: "It may have been through some sort of satnav error that although he drove past Windsor Castle he actually seemed to end up at a pub called the Windsor Castle."

Chowdhury also drove past the Coldstream Guards barracks before heading towards Buckingham Palace.

Jurors were shown footage of the defendant grappling with the officers, who managed to disarm Chowdhury by spraying him with CS gas.

The prosecutor told jurors the officers did not know if Chowdhury had a suicide vest or his car was rigged to explode when they tackled him.

In the struggle over the 42in long sword, Pc Midgley suffered a cut to the palm of his hand and DS Hutt cut his finger.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.