Mohamed Mahmood Alessa, 20, and Carlos Eduardo Almonte, 24, were arrested Saturday at John F. Kennedy International Airport as they prepared to take separate flights to Egypt and then on to Somalia allegedly to join al-Shabaab.
"We will continue to be vigilant and to protect against terrorism no matter where its adherents intend to do harm," said U.S. Attorney Paul J. Fishman
Al-Shabaab forces have been pushing forward across northern parts of Mogadishu for weeks. In late May, they took positions close to the presidential palace and shelled the compound. The group is attempting to topple the transitional government.
The FBI said the pair took part in "tactical training" and saved "thousands of dollars" to prepare themselves for joining the militant group.
Both men showed an undercover officer involved in the investigation militant video and audio recordings they had downloaded from the Internet, including lectures by radical Yemeni cleric Anwar al-Awlaki.
The U.S.-born Awlaki is said to have ties to the alleged would-be bomber of a U.S. passenger jet Christmas Day and U.S. Army Maj. Nidal Malik Hasan, the alleged triggerman in the November shooting in Fort Hood, Texas.
A Texas grand jury last week accused 29-year-old Barry Walter Bujol Jr. of having links to Awlaki.
Washington said Awlaki is wanted dead or alive.