TUCSON, Ariz. — Two men were arrested at Tucson International Airport Friday, where federal authorities say they planned to fly overseas to join ISIS.

According to the U.S. Department of Justice, the two men -- 20-year-old Abdi Yemani Hussein and 21-year-old Ahmed Mahad Mohamed -- were Somali nationals legally living in Tucson, and were arrested after a months-long investigation involving undercover FBI agents.

Authorities say it started in August 2018 when Mohamed started talking to an undercover employee of the FBI on social media, who he thought was an ISIS supporter as well. In their communication, Mohamed repeatedly spoke of his admiration for ISIS, his support for its ideology and his desire to join the terrorist organization overseas.

READ THE FULL CRIMINAL COMPLAINT FROM THE DEPARTMENT OF JUSTICE

At one point, Mohamed told the FBI operative he wanted to be the "beheading guy" if he made it to Syria, according to the criminal complaint. He also said, "I only think about jihad everywhere I go but my father and mom, they don't like jihad if they knew me I want to make hijrah they would spy on me."

"Hijrah," in this context, is "an Arabic phrase referring to a foreign fighter's journey from his/her country of origin to join and fight in terrorist-held territories," according to the criminal complaint.

In their communication online, Mohamed later told the FBI employee again that they had to be careful and that his family would contact authorities if they knew what he was planning.

Mohamed was later introduced to undercover FBI agent, and the two began extensive conversations on an unnamed encrypted messaging app. Eventually, Mohamed met in person with the undercover agent in Tucson.

The two met in the agent's car in February, and their conversation was recorded where Mohamed again expressed his desire to join ISIS overseas.

The next month, Mohamed met with the agent again, this time bringing Hussein as well. Hussein told the agent in the recorded conversation that he wanted to join Al-Shabab -- another terrorist organization -- in Syria.

Over the next several weeks, the two men coordinated travel plans with the undercover agent -- gathering documents and submitting immigration applications, all verified and monitored by federal agents.

In June, the two men met with the undercover agent again. Hussein reportedly told the agent that he will "kill so many people," and that he wants "to be on the front line." He also told the agent that he wanted to blow up the White House, the criminal complaint says, and that if anyone tried to stop him from joining ISIS, he would come to Tucson and the "city will die."

On Thursday, Mohamed told the agent that he and Hussein had bought roundtrip tickets to Cairo, Egypt from Tucson International Airport, for the following day. On Friday, after the men had received their boarding passes and crossed through security at the airport, federal agents took them into custody.