An Uber driver drove at cops outside Buckingham Palace then tried to attack them with a samurai sword because he wanted to "be in paradise with Allah", a court heard.

Mohiussunnath Chowdhury, 27, wrote a "martyrdom note" to his sister which said "the Queen and her soldiers will all be in hellfire" before his attack around 8:30 p.m. on Aug. 25, 2017, it is alleged.

He then swerved his car through cones outside the palace and as two police officers got out of a passing police van he brandished the sword and shouted "Allahu Akbar", jurors were told.

But it was wrestled from him and he was arrested, an Old Bailey jury heard. The Luton man denies one count of engaging in conduct in preparation of terrorist acts.

British national Chowdhury had written the note three hours earlier, after researching terrorists including Khalid Masood, the Westminster Bridge attacker who he described as a "martyr", it was said.

He had also allegedly changed his WhatsApp picture to an ISIS flag and wrote messages of support for the group.

Prosecutor Timothy Cray said: "He stated in clear terms that his intention was to get to paradise by becoming a martyr, fighting in his words 'the enemies of Allah.'"

Part of the note reportedly said: "Tell everyone that I love them and that they should struggle against the enemies of Allah with their lives and 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."

Jurors heard just 30 minutes before he penned the note, he bought a "sharpening tool" from a Sainsbury's which he used with the samurai sword.

Mr. Cray added: "It was due to the bravery and quick reaction of these uniformed police officers that something even more serious did not happen."

Click for more from The Sun.