TUCSON, AZ — Federal agents arrested two men Friday at Tucson International Airport for conspiring to join the Islamic State.

The Federal Bureau of Investigation says Ahmed Mohamed and Abdi Hussein were arrested at the airport on July 26 and says the pair had been communicating with an undercover agent posing as a supporter of ISIS.

Agents say Mohamed started talking with an undercover employee on an unnamed social media platform in August 2018. The conversation continued with a second FBI agent on a different social media platform that December.

The FBI says Mohamed and Hussein wanted to travel overseas to fight for ISIS or conduct an attack within the United States.

Mohamed told the undercover agent, "[I]f I go to Syria I want to be the beheading person," according to court documents. The FBI says he also met with the undercover agent several times in Tucson, and brought Abdi to one of those meetings.

At a following meeting, the FBI says Hussein mentioned he wanted "to be on the front line" and "kill so many people."

Authorities say the pair bought tickets to travel to Egypt and were arrested after checking into their flights and passing through security.

Mohamed and Hussein came to the United States as Somali refugees. Mohamed had obtained lawful permanent resident status by the time of his arrest, but Hussein remains a refugee, the FBI said.