Four members of a British Islamist militant cell who referred to themselves as the "Three Musketeers" were on Thursday given life sentences in prison for plotting an attack.

The four men - Naweed Ali, Khobaib Hussain, Mohibur Rahman, and Tahir Aziz - were arrested in an undercover sting operation in August 2016 after police uncovered a partly-built pipe bomb, an imitation gun and a meat cleaver scratched with the Arabic word for infidel in Ali's car.

"These men shared the same radical belief in violent jihad and had reached a stage where they were planning to take action," said Sue Hemming, the state prosecutor's counter-terrorism chief.

"Recent attacks have demonstrated the kind of horror these defendants could have caused had they not been stopped."

Ali, 28, Hussain, 25, and Rahman, 33, were given life imprisonment with a minimum term of 20 years. Aziz, 38, was sentenced to life with a minimum term of 15 years.

They had been convicted of terrorism offences by a court in London on Wednesday.