LONDON — Six British men who were inspired by Islamic extremist material have been sentenced to almost 20 years in prison each for plotting a bomb and gun attack on a far-right rally.

The six, from the Birmingham area of central England, had earlier pleaded guilty to planning an attack on the anti-immigrant, anti-Muslim English Defense League.

The plot failed when they arrived after the rally had ended. They were caught by chance after a car was impounded for insurance violation. The vehicle contained guns, a home-made bomb and other weapons.