A National Guardsman and his cousin have been arrested for plotting to attack US soldiers on a base in Illinois. If it had gone according to plan, up to 150 people could have been killed.

Hasan Edmonds, 22, was an Illinois National Guardsman serving with the 634th Brigade Support Battalion as a supply specialist. Jonas Edmonds, 29, planned to use Hasan’s uniform to enter the Joliet Armory, where Hasan’s National Guard unit was based. There he would attack using grenades and AK-47s.

For his part, Hasan intended to fly out to Cairo and from there attempt to join the Islamic State, where he intended to use his military training to assist the Islamist terror group.

Originally both men had intended to fly out to Syria, but Jonas has a previous conviction for armed robbery and therefore doubted he would be able to leave the country.

Hasan was arrested on Wednesday night while trying to board a plane at Chicago Midway International Airport. Jonas was arrested two hours later at his home in Aurora, Illinois.

Both men have been charged with conspiring to provide material support and resources to a foreign terrorist organization. They face up to 15 years imprisonment each.

Hasan joined the National Guard in August 2011, according to Lt. Col. Brad Leighton, an Illinois National Guard spokesman. He was responsible for ordering uniforms and other equipment.

The FBI coordinated with the National Guard on the case, leading to Hasan’s work being altered to deny him access to any sensitive information or potentially dangerous equipment.

The FBI became aware of the plot after Hasan communicated with an undercover agent posing as an Islamic extremist via Facebook. They discussed Hasan’s plan to travel to Syria and carry out attacks there.

Documents submitted to court by the prosecution record Hasan as saying: “With the U.S., no matter how many you kill they will keep coming unless the soldiers and the American public no longer have the will to fight. If we can break their spirits we will win."

He went on to express admiration for the attack on the satirical magazine Charlie Hebdo in January which killed 12 people and then five others in a related attack.

Hasan is allegedly recorded saying "Honestly we would love to do something like the brother in Paris did.”

Jonas Edmonds went on to contact another undercover operative last month, also on Facebook, with whom he discussed plans to attack the Joliet military facility.

The pair met with that informant last Monday, leading to their arrest.