ELMWOOD PARK, N.J. (AP)

They were recorded talking jihad against their fellow Americans. But they hadn't talked the jihadists into accepting them.

When the two New Jersey men tried to fly out of New York's Kennedy Airport in hopes of getting terror training in Somalia, investigators who had been following them for years were waiting for each of them at the gate, officials said Sunday.

Mohamed Mahmood Alessa, 20, and Carlos Eduardo Almonte, 26, were arrested Saturday before they could board separate flights to Egypt and then continue on to Somalia, federal officials in New Jersey and the New York Police Department said.

They are the latest of several U.S. Muslims accused of joining or trying to join terrorist groups, radicalized with help from fellow Americans preaching violent jihad over the Internet.

Authorities say they recorded Alessa and Almonte talking about attacking Americans. Alessa allegedly said he would outdo Maj. Nidal Hasan, the Army psychiatrist accused of killing 13 people at Fort Hood, Texas, last year. "He's not better than me. I'll do twice what he did," Alessa was recorded saying, according to court documents.

They had no known connections to established terrorist groups, however. They had traveled to Jordan three years ago and tried to get into Iraq, only to be rejected by jihadists, New York Police Commissioner Raymond Kelly said. Their trip to Somalia apparently amounted to a leap of faith that they would be embraced by al-Shabab, a violent extremist group based in Somalia and connected to al-Qaida.

Though Americans are potentially valuable to terrorist groups, they also carry the risk of being undercover investigators like the one who had gained Alessa's and Almonte's trust well before their arrests.

In March, Alessa was recorded telling Almonte and the NYPD undercover officer that no one else they knew in New Jersey should be included in their plan to join al-Shabab because only the three of them were "serious about their plan and were preparing for it." Court documents do not indicate that authorities had other targets in the investigation.

Law enforcement became aware of the men in the fall of 2006, after receiving a tip. Since then, during the lengthy investigation, the undercover officer recorded conversations with the men in which they spoke about jihad against Americans.

"I leave this time. God willing, I never come back," authorities say Alessa told the officer last year. "Only way I would come back here is if I was in the land of jihad and the leader ordered me to come back here and do something here. Ah, I love that."

Kelly said Alessa, of North Bergen, and Almonte, of Elmwood Park, are American citizens. Alessa was born in the United States and is of Palestinian descent. Almonte is a naturalized citizen who was born in the Dominican Republic.