Authorities say two New Jersey men arrested at a New York City airport allegedly on their way to join a jihadist group in Somalia had previously tried to get into Iraq.

New York City Police Commissioner Raymond Kelly says Mohamed Mahmood Alessa, 21, and Carlos Eduardo Almonte, 23, had gone to Jordan in 2007. From there, they tried to get into Iraq but were turned back.

The two were arrested Saturday at John F. Kennedy International Airport before they could board separate flights to Egypt and then presumably continue on to Somalia to join the terrorist network al-Shabab, a group with links to Al Qaeda.

"It's a cause for concern," Kelly told reporters during a press conference on Sunday.

"It's not unlike other cases that we've seen recently where individuals who express an interest to do 'jihad' go overseas and then are turned around" and "come back to attempt acts of violence in the United States," he said, citing other high-profile cases, like Najibullah Zazi and Faisal Shahzad, both charged with plotting separate acts of terror inside the United States.

Alessa, of North Bergen, and Almonte, of Elmwood Park, have been charged with conspiring to commit an act of international terrorism.

State and federal law enforcement agents have been investigating Alessa and Almonte since 2006, intercepting several conversations between the two about beheading Americans and committing acts of terror.

On Nov. 29, 2009, authorities recorded a conversation between Alessa and Almonte in which Alessa allegedly said: "They only fear you when you have a gun and when you -- when you start killing them, and when you -- when you take their head, and you go like this...and you behead it on camera."

"We'll start doing killing here. If I can't do it, over there," Alessa said, according to the U.S. District Attorney's office.

Speaking of Fort Hood shooter Maj. Nidal Malik Hasan, charged with killing 13 people and wounding scores of others in a Nov. 5, 2009, massacre, Alessa allegedly told an undercover agent: "He's not better than me. I'll do twice what he did."

Almonte reportedly told the undercover officer in April that there would soon be American troops in Somalia, which he allegedly said was good because it would not be as gratifying to kill only Africans.

"My soul cannot rest until I shed blood," Alessa said, according to court documents. "I wanna, like, be the world's known terrorist."

Alessa, a U.S. citizen of Palestinian descent, and Almonte, a naturalized U.S. citizen born in the Dominican Republican, are scheduled to appear Monday in federal court in Newark.

Alessa and Almonte had planned their trip to Somalia for several months, saving thousands of dollars, undergoing tactical training and test runs at paintball fields to condition themselves physically, and acquiring equipment and clothing they could use when they joined al-Shabab, officials said. Both had reportedly bragged about wanting to wage holy war against the United States both at home and internationally.

Officials said the two men were not planning an imminent attack in the New York-New Jersey area.

A neighbor of Alessa's, Helen Gonyou, said Alessa was attending school and lived with his parents but that she had not seen him in a while. They are good neighbors, she said, adding that she regularly exchanged pleasantries with Alessa's father.

She cautioned against prejudgment and called the charges an "unfortunate set of circumstances."

"I just have to hope that if the case is true, they caught them before they could do bodily harm to anyone," she said.

Fox News' David Lee Miller and the Associated Press contributed to this report