A man accused of plotting terror attacks at tourist hotspots bragged to undercover officers that he had previously deceived a jury into clearing him over a sword attack on police outside Buckingham Palace, a court has heard.

Mohiussunnath Chowdhury, 28, from Luton, Bedfordshire, is on trial at Woolwich crown court for allegedly planning to kill members of the public at busy London locations including Madame Tussauds, the Gay Pride parade and on an open-top tour bus.

He was acquitted of a terror charge by an Old Bailey jury after attacking police officers with a sword outside the Queen’s London residence in 2017. But prosecutor Duncan Atkinson QC told Woolwich crown court that after Chowdhury was cleared, he became driven by “dreams of martyrdom”.

From January 2019, three undercover officers worked to earn Chowdhury’s trust and to tap into his extremist views and he unwittingly confided his plans to them, the court heard.

Atkinson said: “Believing them to be as sincerely committed as he was, he told them of his devotion to the cause of violent Islamic extremism, the basis for this devotion and the skewed religious beliefs that underpinned it …”

“Various potential targets were discussed between the defendant and those he believed to be committed to the same cause and the same forms of violence as himself.

“The object was to unleash death and suffering on non-Muslim members of the public who happened to be present, using a firearm, sword and even a van as part of an attack.”

In the 2017 incident, two unarmed officers suffered cuts to their hands when they fought to disarm Chowdhury near the Queen’s London residence as he shouted repeatedly “Allahu Akbar” (God is the greatest).

He had claimed the incident outside Buckingham Palace had been an attempt at suicide and it was not an attack. But after being cleared in December 2018, he posted an Instagram message describing the police officer who had confronted and disarmed him outside Buckingham Palace as a “cuck”.

Atkinson told jurors Chowdhury’s assertions to the undercover officers amounted to an admission that he was “indeed trying to carry out a terrorist attack in 2017 and that he had deceived the earlier jury that acquitted him of it”. The prosecutor added: “Whatever the position in 2017, he was unquestionably preparing for terrorism in 2019.”

He said the defendant was able to buy a replica Glock gun and told the undercover officers of his plans.

“He told them of his training regime, and sought to involve them in his firearms-related training,” said Atkinson. “He told them of what he was wanting and planning to do, and sought to involve them in the carrying out of one or more terrorist attacks.”

The lawyer said Chowdhury, inspired by hate preachers such as the deceased Yemeni-American cleric Anwar al-Awlaki, began preparations “to undertake that which he had been stopped from doing in 2017 – an act of terrorism”.

On 10 March 2019, the defendant used his sister Sneha Chowdhury’s bank account to buy two Red Oak Bokken wooden training swords, which were delivered to their home address, the court heard. His sister, who is also on trial, did nothing to stop her brother’s plans, Atkinson told the court.

Mohiussunnath Chowdhury is charged with one count of engaging in conduct in preparation of terrorist acts, collecting information likely to be useful to a person committing or preparing an act of terrorism and of disseminating terrorist publications.

His sister, of the same address, denies two charges of failing to disclose information about acts of terrorism.

The trial continues.