(CNN) -- The two New Jersey men suspected of attempting to fly to Somalia to join a terrorist organization were denied bail at a court hearing on Thursday.
Mohamed Mahmood Alessa, 20, of North Bergen, New Jersey, and Carlos Eduardo Almonte, 24, of Elmwood Park, New Jersey, are charged with one count each of conspiracy to kill, maim and murder persons outside of the United States, which carries a maximum sentence of life in prison.
The men, who were taken into custody at John F. Kennedy International Airport on Saturday, intended to take separate flights to Egypt on their way to Somalia "to join designated foreign terrorist organization Al-Shabaab and wage violent jihad," according to federal prosecutors.
The criminal complaint filed in U.S. District Court in Newark alleges that in 2007, Alessa and Almonte traveled together to Jordan, where they intended to enter Iraq in order to commit violence against U.S. troops there.
The U.S. attorney's office in New Jersey said the investigation of the two men began with a tip to the FBI -- from someone who knew them -- in October 2006.