Six men who conspired to attack a rally by the UK’s far-right English Defence League (EDL) in June 2012 have been given lengthy prison sentences in London.

The six had plotted to attack the EDL movement’s march through Dewsbury using two sawn-off shotguns, two machetes, swords, knives and a home-made nail bomb, which the judge, Nicholas Hilliard, described as a “horrible weapon” designed to cause “serious, possibly fatal injuries”.

The plot failed, as the would-be attackers arrived hours after the rally had finished. They decided to return to their homes in Birmingham when one of their cars was stopped by police, who found it was uninsured and impounded it.

Officers later found weapons in the vehicle and ten copies of a document written to the “enemies of Islam”, Queen Elizabeth and UK Prime Minister David Cameron, explaining the reasons for the attack: “Today is a day of retaliation (especially) for your blasphemy of Allah and his Messenger Mohammed”, the note read.

Extreme ideological material was also found in the men’s home, including instructions on how to make a pipe bomb. The judge at the Old Bailey court noted that those at risk from the attack included police officers and members of the general public, not just EDL supporters. He added that if the attack had have been successful, it could have provoked what he called “a spiral of tit-for-tat violence”.

Omar Khan, Jewel Uddin and Zohaib Ahmed were sentenced to 19 years and 6 months, while Mohammed Saud, Anzal Hussain and Mohammed Hasseen were given terms of 18 years and 9 months.