Two Westminster men plotted to kill British soldiers and policemen in drive-by moped shootings after being inspired by “warped” Islamic State (IS) ideology, a court heard.

Suhaib Majeed, 21, and Nyall Hamlett, 25, are among four alleged jihadists who are accused of planning terrorist murders on the streets of London.

Jurors heard how they carried out “hostile reconnaissance” on targets including a police station and an army barracks.

Prosecutor Brian Altman QC said: “With their arrests, the police successfully disrupted a plot to kill a police officer, a soldier or possibly even a civilian, in one or more terrorist attacks, which, if the plot had been allowed to run its course, which would have resulted in a terrorist murder or murders on the streets of London, according to the warped ideology of the defendants.”

But the plot was foiled by anti-terror police, the Old Bailey heard.

The men were allegedly inspired by a 42-minute hate speech by IS spokesman Abu Muhammad al-Adnani al-Shami.

The court heard that ringleader Tarik Hassane, 22, of north Kensington, would issue instructions to physics student Majeed, of Church Street Estate, St John’s Wood, who was responsible for secret communications.

The pair sourced a gun with live ammunition and a silencer and planned to get hold of an untraceable moped, jurors were told.

When officers raided Majeed’s family home, armed officers stationed outside saw the firearm, ammunition and silencer being thrown out of his bedroom window, the court was told.

Hamlett, a cleaner, of Great Western Road, Paddington, was said to have acted as a middleman in the alleged plot.

The men deny conspiracy to murder between July 8, 2014, and September 25, 2014, and preparation of terrorist acts between the July 8, 2014, and the October 7, 2014.

The trial continues.