New York (CNN) -- Two New Jersey men arrested at a New York airport planned to travel to Somalia to "wage violent jihad," and also had expressed a willingness to commit violent acts in the United States, according to prosecutors and a federal criminal complaint.
Mohamed Mahmoud Alessa, 20, of North Bergen, New Jersey, and Carlos Eduardo Almonte, 24, of Elmwood Park, New Jersey, were taken into custody Saturday at John F. Kennedy International Airport. The two intended to take separate flights to Egypt on their way to Somalia "to join designated foreign terrorist organization al-Shabaab and wage violent jihad," federal prosecutors said in a statement.
The two are charged with conspiring to kill, maim and kidnap people outside the United States, according to court documents.
Read the criminal complaint against Alessa and Almonte (PDF)
The FBI received a tip regarding the men's activities in October 2006, according to the U.S. Attorney's office in New Jersey.
The tip, from someone who knew the men, said, "Every time they access the Internet all they look for is all those terrorist videos. ... They keep saying that Americans are their enemies, that everybody other than Islamic followers are their enemies ... and they all must be killed."
As part of the investigation, an undercover officer with the New York Police Department's intelligence unit "recorded numerous meetings and conversation" with the two men, prosecutors said.
During those meetings, they discussed a plan under which they would save thousands of dollars and physically condition themselves through paintball and other training, then acquire military gear and apparel for use overseas, and buy plane tickets to Egypt with the intent to travel to Somalia.
"The defendants also discussed their obligation to wage violent jihad and at times expressed a willingness to commit acts of violence in the United States," prosecutors said.
On April 25, for instance, Almonte said "that there would soon only be American troops in Somalia, which was good because it would not be as gratifying to kill only Africans," according to prosecutors.
And in November 2009, Alessa said in part, "We'll start doing killing here, if I can't do it over there," according to the criminal complaint. In an apparent reference to Maj. Nidal Hasan, charged with the deaths of 13 people in a shooting spree at Fort Hood, Texas, Alessa said, "He's not better than me. I'll do twice what he did."
In January, the two lifted weights together, and Alessa stated in part "that stronger muscles means bigger muscles which means killing more non-Muslims," according to the complaint.
In December, authorities interviewed a member of Almonte's family, who told them that when Almonte was interviewed previously outside his home, Alessa was hiding inside the home and in possession of a large knife, and told Almonte's family members he would kill the agents if they came inside.
The two traveled to Jordan together in 2007, the complaint said. New York Police Commissioner Raymond Kelly told reporters they intended to go to Iraq to fight, but did not make it there.
The two spent a lot of time in New York, specifically Brooklyn, he said, and that's why the NYPD was involved.
The two men also watched and played for the undercover officer "numerous video and audio recordings" promoting jihad, including lectures by fugitive American-born cleric Anwar al-Awlaki and videos showing attacks by al-Shabaab.
In the presence of the undercover officer, Alessa discussed with his father buying a plane ticket to Egypt, ostensibly for him to attend school there, according to the criminal complaint.
Authorities met the pair at the airport with arrest warrants Saturday, prosecutors said. The two were arrested after they had gone through security but just prior to boarding -- an intentional move, a law enforcement official told CNN, as authorities wanted to establish they were intending to go overseas.
Alessa resisted arrest "a bit," the official said.
The two are scheduled to appear Monday before a U.S. magistrate judge, prosecutors said. If convicted, each faces a maximum sentence of life in prison.
"I was surprised" at Alessa's arrest, his landlord, Hemant Shah, told reporters. "It was just yesterday when I talked to him. I said, 'Hi, I heard you're going away.' He said, 'Yes, I'm going out.' I said, 'For how long?' He said, 'Probably about six months.'"
Earlier, a spokeswoman for the U.S. Attorney's office in Newark, New Jersey, Rebekah Carmichael, said the arrests did not relate to "any known immediate threat to the public or active plot against the United States." The FBI and NYPD said the arrests were part of an ongoing operation, and the FBI said the airport was not at risk.
Asked about the operation, Kelly said, "As in gun trafficking and narcotics investigations, the NYPD cannot acknowledge publicly individual undercover police officers who have infiltrated suspects. Nonetheless, we are indebted to them.
"Even when individuals plan to support terrorist activity abroad, we remain concerned that once they reach their foreign destinations they may be redirected against targets back home, as we've seen in the past," Kelly said. "We are also concerned that should they remain undetected and fail in their foreign aspirations that they might strike domestically, as was discussed as a possibility in this case."
FBI agents also raided two homes in New Jersey, the Newark Star-Ledger newspaper reported, and the arrests were part of an investigation known as Operation Arabian Knight.
They come a month after Faisal Shahzad, a 30-year-old Pakistani-American, was taken into custody in connection with a botched vehicle bomb attempt in New York's Times Square on May 1. Shahzad, who faces five counts, could be sentenced to life in prison if convicted.
CNN's Jeanne Meserve contributed to this report.