A federal jury on Wednesday found three men guilty of plotting to bomb a mosque and an apartment building that housed Muslim Somali refugees in Kansas the day after the 2016 presidential election.

Patrick Stein, 49, Curtis Allen, 50, and Gavin Wright, 49, were convicted of one count of conspiracy to use a weapon of mass destruction and one count of conspiracy against civil rights, the US Attorney's Office announced. The jury also convicted Wright of lying to the FBI.

They are scheduled to be sentenced on June 27.

"The jury’s verdicts in this case are a vindication of outstanding investigative work and prosecution," US Attorney Stephen McAllister told reporters. "Terrorists whether foreign or domestic must be stopped and punished according to the law."

The three men, who were members of a militia group in Kansas, wanted to detonate four parked vehicles filled with explosives outside the apartment complex in Garden City to "wake people up," officials said. They were indicted and arrested in October 2016 following an eight-month investigation by the FBI.

Evidence presented during the four-week trial showed the men held multiple meetings to plan the attack and made and tested explosives leading up to their arrests, McAllister said.

A confidential source attended those meetings and recorded numerous conversations in which the men discussed their plan and expressed hatred for the Somali immigrants and Muslims in general.

The men considered attacking churches, homes, and apartment buildings frequented by Somali immigrants who had settled in the area, officials said, often referring to them as "cockroaches." They eventually honed in on the Garden City apartment building where immigrants maintained a small mosque.

McAllister said the recordings were "extremely important" in the case, adding that the confidential source should be commended for his courage.

"It's always helpful for a jury to hear in the defendants' own words what the defendants were talking about," he said. "I have no doubt they were influential."

Stein also met with an undercover FBI agent posing as a black market arms dealer in an attempt to obtain a bomb, the US Attorney's Office said in a statement. During one of those meetings, Stein showed the agent the apartment building the men planned to destroy.

"Our colleagues in the FBI and other federal departments are dedicated every day 24/7 to protecting the citizens of this country," McAllister said, adding that the outcome of this case was "a testament to our jury system."