Three members of a Kansas militia group were accused of planning a bomb complex inhabited by Somali immigrants in the city of Garden City.

The foiled attack is said to have been planned for the day after the US elections next month.

The arrests were the culmination of an eight-month FBI investigation that took agents “deep into a hidden culture of hatred and violence,” said acting US attorney Tom Beall.

Curtis Wayne Allen, 49, Patrick Eugene Stein, 47 and Gavin Wayne Wright, 49, are due to appear in court on Monday for conspiring to use a weapon of mass destruction.

The men are said to be members of a small militia group called “Crusaders”, whose members campaign for sovereign citizens, anti-government, Muslim and anti-immigrant extremist beliefs.

The complaint alleges that group members selected the target because of their hatred of Muslims, Somali people and immigrants – and a desire to inspire and “wake people up” other militia groups.

The FBI opened a domestic terrorism investigation into the group in February and a confidential source attended its meetings in southwest Kansas.

At a meeting in June, Stein reportedly brought up the shooting in the Orlando nightclub and, according to the complaint, proposed a similar attack on Muslim refugees in Garden City.

Prosecutors believe that due to the number of Somalis living there and the fact that one of the apartments was used as a mosque, they ultimately decided to target the apartment complex. The complex is home to about 120 Somali residents.

The complaint said Stein had discussed the explosives Timothy McVeigh used in the 1995 bombing of the federal building in Oklahoma City.

The men arrested in Liberal on Friday morning were monitoring the apartment building and had prepared a manifesto, Beall said.

If convicted, the men could be sentenced to life imprisonment without parole.

Heidi Beirich, director of the Southern Poverty Law Center’s intelligence project, described the details of the alleged conspiracy as troubling and said it should “serve as a warning to those engaged in the politics of fear and bigotry”.

Garden City is home to a Tyson Foods beef slaughterhouse, which has drawn a diverse immigrant population to the area.

Garden City Mayor Chris Law said in a statement that he was shocked by the alleged plans, adding: “Today it should also be remembered that vigilance should be a common practice for all citizens.”