CHICAGO — A Chicago federal judge on Tuesday sentenced a former Illinois National Guard soldier and his cousin to prison for plotting to join Islamic State fighters and to attack a U.S. military facility.

Hasan Edmonds, 23, the former soldier, was sentenced in U.S. District Court to 30 years in prison. His cousin, Jonas Edmonds, 30, received a 21-year prison sentence.

The sentences matched what prosecutors asked for the men, both residents of suburban Aurora.

Hasan Edmonds devised a plan to travel to the Middle East while Jonas Edmonds attacked the National Guard armory in Joliet, about 45 miles (70 kilometers) southwest of Chicago, according to prosecutors. The goal, prosecutors say, was to kill as many as 150 people at the facility.

Jonas Edmonds said he dropped Hasan Edmonds at the airport to travel to the Middle East to join Islamic State fighters. But Jonas Edmonds denied he would have attacked the military armory.

“The person they’re trying to make me into, I’m not that person,” Edmonds told U.S. District Judge John Lee.

Defense attorney James Graham told the judge that Edmonds was a heavy smoker of marijuana and was boastful, but had no weapons and never would have gone through with the attack.

It was a characterization that was dismissed by Assistant U.S. Attorney Barry Jonas, who noted as he held up a duffel bag filled with National Guard uniforms that Edmonds planned to don the uniform to help him blend in and gain access to the armory for the attack.

“Thank God the FBI was there to stop him,” Jonas said.

After dropping his cousin off at Chicago’s Midway International Airport on March 25, 2015, Jonas Edmonds went to his cousin’s home and collected the uniforms, according to prosecutors. Hasan Edmonds, filings say, instructed Jonas to kill high-ranking officers first.

Agents arrested Hasan Edmonds at the airport and detained Jonas Edmonds at his home shortly thereafter.

Under plea agreements, Hasan Edmonds pleaded guilty to two counts of conspiring to provide material support to a foreign terrorist organization. Jonas Edmonds pleaded guilty to conspiring to provide material support to a foreign terrorist organization and lying to federal agents.