Two British students have been sentenced to more than 20 years in prison for conspiring to kill soldiers, police officers and civilians in a plot inspired by the Islamic State group.

Judge Alan Wilkie sentenced plot mastermind Tarik Hassane on Friday to life with no chance of parole for 21 years, and told physics student Suhaib Majeed he must serve at least 20 years. Both men are 22.

Prosecutors say the plot involved a plan to shoot from a moped and then ride off. Hassane had scouted possible sites in west London, including a police station and an army barracks, using Google Street View.

Acting on instructions from Hassane, Majeed obtained a gun and ammunition and was discussing buying an untraceable moped before police arrested him in September 2014.