Two Illinois men who had taken photos of themselves posing with the Islamic State flag on a beach and trained to be ready to fight alongside the terrorist group in the Middle East were arrested and charged Wednesday with conspiring to provide material support to ISIS, according to a Justice Department press release.

Joseph D. Jones, also known as Yusuf Abdulhaqq, and Edward Schimenti, known as Abdul Wali, were picked up by police Wednesday morning after driving an undercover source to O'Hare International Airport in Chicago on April 7 so that he could travel to Syria to join the Islamic State, prosecutors said. The men also gave their source multiple cell phones that they believed would be used to detonate explosives in attacks overseas.

Both men are 35-year-old U.S. citizens and reside in Zion, Ill., located 45 miles north of downtown Chicago.

Jones and Schimenti first shared their plans to join the terrorist group in fall of 2015. Around the same time, Jones and Schimenti started posting messages of support for the Islamic State on various social media channels, according to a complaint and affidavit filed in U.S. District Court in Chicago.

The duo befriended two undercover FBI agents and a third person who was working with law enforcement, but not a federal employee. The third person told the men of plans to join the terrorist group overseas. Jones and Schimenti began regularly meeting with him and the two other undercover officers at locations around the greater metropolitan area, including in Waukegan, Zion, Bridgeview, North Chicago, Highland Park and Chicago.

The suspects showed the agents pictures they had taken of themselves at the Illinois Beach State Park posing with the infamous black and white Islamic State flag. Schimenti added that he would like to see that flag "on top of the White House."

The two also participated in physical training exercises with the cooperating source, including one session at a gym in Zion.

"Understanding that the cooperating source intended to travel overseas to fight for ISIS, Schimenti commented that the exercises would "'make you good, you know, in the battlefield,'" the press release cites from the complaint.

The suspects made their first appearance before a judge on Wednesday afternoon. Acting Assistant Attorney General for National Security Mary B. McCord, Acting U.S. Attorney Joel R. Levin for the Northern District of Illinois and Special Agent in Charge Michael J. Anderson of the FBI's Chicago Office announced the charges.

Each suspect faces up to 20 years in prison if convicted of the charge.